Question: Exercise 2 . 3 ( 2 0 marks ) Using a single print statement and the variables created earlier, print your Name in the next
Exercise marks
Using a single print statement and the variables created earlier, print your Name in the next line your Age, and after three lines your Height.
name inputPlease enter your name: upper
age intinputPlease enter your age:
height floatinputPlease enter your height in inches:
Please enter your name: aleck
Please enter your age:
Please enter your height in inches:
printName: name,"
Age:", age,"
height:",height
statements Thank you for your order','Would you like fries with that too? Y or N
'Excellent, Ill add them to your order, Have a nice day!
'Are you sure? They are really yummy Y or N
Ok no fries!
Have a nice day cheapskate',
'You did not enter a Y or N I cant take this ambiguity, I quit'
printstatements
fries strinputstatementsupper # input with prompt, typecast into string, force uppercase
# selection
if fries Y:
printstatements
elif fries N:
printstatements
fries strinputstatementsupper # input with prompt, typecast into string, force uppercase
if fries Y:
printstatements
elif fries N:
printstatements
else:
printstatements
Thank you for your order
Would you like fries with that too? Y or N y
Excellent, I'll add them to your order, Have a nice day!
if you use yes or Yes as an answer to the input you get the response 'You did not enter a Y or N I can't take this ambiguity, I quit' but if you use y you get a different response. Why does small letter y work but we have capital letter Y in the statement.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
