Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python: I have a problem with converting strings to float input 'Eric Cartman'? ** Input and output should be EXACTLY like the one on the

Python: I have a problem with converting strings to float input 'Eric Cartman'? ** Input and output should be EXACTLY like the one on the bottom.

input:

5 Stan Marsh 3.6 Kenny McCormick 2.3 Someone with a really long name more than 20 characters Eric Cartman -1.1 Kyle Broflovski 4.0

Output:

How many students are in the class? Enter the name of student: Enter the gpa of student: Enter the name of student: Enter the gpa of student: Enter the name of student: Name of student cannot exceed 24 characters. Enter the name of student: Enter the gpa of student: GPA of student must be between 0.0 and 4.0. Enter the name of student: Enter the gpa of student:

My Code:

num_of_students=int(input())

for i in range(num_of_students): # Name of student name_of_student=input() # GPA of Students gpa_of_student=input()

print('How many students are in the class?') for j in range(num_of_students): while(len(name_of_student)>24): print('Name of student cannot exceed 24 characters') continue print("Enter the name of student:") print("Enter the gpa of student:")

while(float(gpa_of_student)<0.0 or float(gpa_of_student)>4.0): print('GPA of student must be between 0.0 and 4.0') continue print("Enter the name of student:") print("Enter the gpa of student:")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions

Question

2. What are implementation intentions?

Answered: 1 week ago