Answer to Question #98720 in Python for ed

Question #98720
What is your first name? Ada
What is your last name? Lovelace
Student ID: 3456

Enter the next class, STOP to end: English 11
Enter the room number: 456

Enter the next class, STOP to end: Government
Enter the room number: 143

Enter the next class, STOP to end: Art History
Enter the room number: 943

Enter the next class, STOP to end: Algebra II
Enter the room number: 571

Enter the next class, STOP to end: Chemistry
Enter the room number: 467

Enter the next class, STOP to end: AP Comp Sci
Enter the room number: 510

Enter the next class, STOP to end: STOP
1
Expert's answer
2019-11-17T12:47:20-0500
answer = ''
d = {} #dictionary with enter data
count = 0

while(True):

    if (count == 0):
        d["first_name"] = input("What is your first name?: ")

    elif (count == 1):
        d["last_name"] = input("What is your last name?: ")
        d["Student_id"] = input("Student id: ")
    else:
        answer = input("Enter the next class, STOP to end: ")
        if answer == "STOP":
            break
        d[answer] = int(input("Enter the room number: "))
    count += 1




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS