Am i reading this MOOC question wrong? /u/Bibileiver Python Education

It tells me putting in “Kramer” should print out “Next please!”

“Please write a program which asks for the user’s name. If the name is anything but “Jerry”, the program then asks for the number of portions and prints out the total cost. The price of a single portion is 5.90.”

My code:

name = (input("Please tell me you name:")) if name != "Jerry": price = 5.9 portions = int(input("How many portions of soup?")) total = price * portions print(f"The total cost is {total}") else: print("Next please!") 

submitted by /u/Bibileiver
[link] [comments]

​r/learnpython It tells me putting in “Kramer” should print out “Next please!” “Please write a program which asks for the user’s name. If the name is anything but “Jerry”, the program then asks for the number of portions and prints out the total cost. The price of a single portion is 5.90.” My code: name = (input(“Please tell me you name:”)) if name != “Jerry”: price = 5.9 portions = int(input(“How many portions of soup?”)) total = price * portions print(f”The total cost is {total}”) else: print(“Next please!”) submitted by /u/Bibileiver [link] [comments] 

It tells me putting in “Kramer” should print out “Next please!”

“Please write a program which asks for the user’s name. If the name is anything but “Jerry”, the program then asks for the number of portions and prints out the total cost. The price of a single portion is 5.90.”

My code:

name = (input("Please tell me you name:")) if name != "Jerry": price = 5.9 portions = int(input("How many portions of soup?")) total = price * portions print(f"The total cost is {total}") else: print("Next please!") 

submitted by /u/Bibileiver
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *