Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Missing Assignments

Views: 711
Kernel: Python 3 (Anaconda 5)
#Ex 4: Creating a simple computer survey print("Hello!") print("Thank you for taking this survey.") #Simple survey inputs and defined strings relating to those name = input("What is your name? ") age = int(input("What is your age? ")) dept = input("What university department do you belong to? ") type = input("What position do you hold? (Student or Staff) ") #Using those strings to print a line summarising the results print("Your name is ", name, ", your age is ", age, " and you belong to the ", dept, " department, where you are a ", type, ".", sep="") #Calculating the age difference from the UK median of 40.5 years #x = int(age) #converts from string to integer median = 40.5 agediff = median-age print("Your age is" ,agediff, "years off the UK median of",median,"years")
Hello! Thank you for taking this survey.
What is your name?
What is your age?
What university department do you belong to?
What position do you hold? (Student or Staff)
Your name is Jordan, your age is 19 and you belong to the Physics department, where you are a Student. Your age is 21.5 years off the UK median of 40.5 years