Convert the following code to an if-elif-else statement.(using python) code = in
ID: 3754508 • Letter: C
Question
Convert the following code to an if-elif-else statement.(using python)
code = input("Enter a code value <11, 22, 33>: ")
if code == '11':
print("11: score one")
else:
if code =='22':
print("22: street and road")
print("Street: Hastings St.")
print("road: Boundary Road.")
else:
if code == "33":
print("33: Three items")
print("a. apple")
print("b. baby")
else:
print("Other things")
print("Finish")
Explanation / Answer
code = input("Enter a code value : ") if code == '11': print("11: score one") elif code == '22': print("22: street and road") print("Street: Hastings St.") print("road: Boundary Road.") elif code == "33": print("33: Three items") print("a. apple") print("b. baby") else: print("Other things") print("Finish")Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.