+ 5
Where's the problem
18 odpowiedzi
+ 5
Rayan Chan
x=int(input("how old are you?"))
if x >= 18:
print("oh you are a grown up person")
else:
print("you\'re just a child")
+ 5
to get the output with print, we do not need to escape the single quote inside double quotes:
print("you'r just a child") # this is ok
+ 4
https://code.sololearn.com/cf46Q9ur3tvH/?ref=app
You missed the indentation and for else part no condition is required. Also for print statement double quotes (" ") are required.
+ 4
Lothar
Thanks 😆.. I didn't know that
+ 4
Sanjay Kamath
Thank you🙃
That is bonus info🤩.. But, when do we use elif ?
+ 3
Abhi Varshini
Thank you 🤩
+ 3
Abhi Varshini
Thanks.. i got it now 🙃♥️
+ 3
White spaces are 3 types.., 1) newline 2) tab space 3) normal space
+ 3
You have to include an else statement
x = int(input("how old are you"))
if x >= 18:
print("oh you are grown up person")
else:
print("you are just a child")
+ 2
Rayan Chan elif stands for else if. The structure is if..elif..else.
+ 2
White spaces are missing...
You know bro it's python, it's very strick at white spaces unlike cpp or java.
+ 2
Modified your code Rayan Chan
https://code.sololearn.com/cNGHch6oWomX/?ref=app
+ 2
Anshul Khangar
Thanks for the info.. If I can ask.. What are the white spaces?🤔 And when do we use them?
+ 2
Sometimes \n is important
+ 2
VENKATA SRINIVAS KATTA
Oooh!!, So they called white spaces!!
Thanks 😆
+ 2
I fixed it look
https://code.sololearn.com/cUkZchE2Av15/?ref=app
+ 1
Andrew Musanyera
Hmm.. that's right.. thanks, 😆