Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python: I need help with converting strings to float input without any string formaters like %s ? Input: 5 Stan Marsh 3.6 Kenny McCormick 2.3

Python: I need help with converting strings to float input without any string formaters like %s ?

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:
Number Name GPA ------------------------------------- 1 Stan Marsh 3.6 2 Kenny McCormick 2.3 5 Kyle Broflovski 4.0 Average GPA: 3.3000000000000003

My Code:

#Number of students 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("") print('How many students are in the class?') for j in range(num_of_students): if(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:") if(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 Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

=+26.14. 1 Show that y has no point masses if 2(t) is integrable.

Answered: 1 week ago

Question

5. Recognize your ability to repair and let go of painful conflict

Answered: 1 week ago