Fix this Python code:
myname = input("please enter your name")
myage = int(input(please enter your age"))
print("your name is ", myname, "your age is", myage)
If(myage >18):
print("Your ages tells people that you are an adult", myage)
else:
print("Your ages tells people that you are a child", myage)
print("The program has finished")
Answers
myname = input("please enter your name")
myage = int(input(please enter your age"))
correction:- myage = int(input("please enter your age"))
print("your name is ", myname, "your age is", myage)
If(myage >18):
print("Your ages tells people that you are an adult", myage)
correction:- print("Your ages tells people that you are an adult", myname)
else:
print("Your ages tells people that you are a child", myage)
correction:-
print("Your ages tells people that you are a child", myname)
print("The program has finished")
Answer:
myname = input("please enter your name")
myage = int(input("please enter your age"))
print("your name is ", myname, "your age is", myage)
if (myage >18):
print("Your ages tells people that you are an adult", myage)
else:
print("Your ages tells people that you are a child", myage)
print("The program has finished")
Explanation:
you spelled if as If with capitals letters and it will not accept that, and for the myage input you forgot to put (") so it shoud have looked like this ("please enter your age")) you forgot to indent the print after the if(myage >18): statment