41.9k views
1 vote
Write Python statements that declare the following variables: firstName of type string and studyHours of type float. Prompt and input a string into firstName and a float value into studyHours. Then multiply the studyHours by 3 and print "On Saturday, you need to study x hours for the exam." where x is the studyHours times 3. 3. Write a Python statement that output the following lines: Provided that the user entered John and 4.5. Hello, John! On Saturday, you need to study 13.5 hours for the exam. Use two lines for variables and input, and one line for print(). You can use print() only 1 time. Your script file should contain only 3 lines of code excluding comments. "Use only topics (Ch02 and lecture) that were covered in class. Your program output must be exactly the same as the output in the OUTPUT section, except font style. OUTPUT: - The bold text is the user's input. Enter your first name: John Enter your expected study hours on Saturday: 4.5 Hello, John! On Saturday, you need to study 13.5 hours for the exam. Enter your first name: Sam Enter your expected study hours on Saturday: 2.5 Hello, Sam! On Saturday, you need to study 7.5 hours for the exam.

User Nmclean
by
7.6k points

1 Answer

2 votes

Answer:

firstName=input("Enter your first name: ")

studyHours=float(input("Enter your expected study hours on Saturday: "))

print("Hello, " + firstNme + "! On Saturday, you need to study " + str(int(studyHours) * 3)) + " hours for the exam."

Step-by-step explanation:

User FoxDeploy
by
8.2k points