+ 2
How to know every detail in one execution?
print ("what do u want to know about u?") print ("name\nage\nheight\nfav_number\nfav_chocolate\nfav_colour\nfav_flavour") x=input ("info u want to know\n") if x=="age": print("20") elif x=="name": print("jaanu") elif x=="fav_colour": print("pink") elif x=="fav_flavour": print("strawberry ") elif x=="height": print("6 feet") elif x=="fav_number": print("3") elif x=="fav_chocolate": print("kit kat")
3 Respuestas
+ 2
If you enter the inputs as :
height fav_colour
in a single line this works
print ("name\nage\nheight\nfav_number\nfav_chocolate\nfav_colour\nfav_flavour")
x=input("info u want to know\n").split()
for i in x:
if i=="age":
print("20")
elif i=="name":
print("jaanu")
elif i=="fav_colour":
print("pink")
elif i=="fav_flavour":
print("strawberry ")
elif i=="height":
print("6 feet")
elif i=="fav_number":
print("3")
elif i=="fav_chocolate":
print("kit kat")
+ 1
#How to know every detail in one execution?
print ("do u want to know about me?")
#print ("name\nage\nheight\nfav_number\nfav_chocolate\nfav_colour\nfav_flavour")
x=input ("y/n\n")
if x=="y"or x=="Y":
print ("name=jaanu\nage=20\nheight=6feet\nfav_number=3\nfav_chocolate=kit kat\nfav_colour=pink\nfav_flavour=strawberry")
else:
print("get lost")
0
Adding While True is enough...