14th Apr 2022, 10:50 AM
Rayan Chan
Rayan Chan - avatar
18 Respuestas
+ 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")
14th Apr 2022, 11:13 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 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
14th Apr 2022, 3:01 PM
Lothar
Lothar - avatar
+ 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.
14th Apr 2022, 11:05 AM
Abhivarshini Maddala
Abhivarshini Maddala - avatar
+ 4
Lothar Thanks 😆.. I didn't know that
14th Apr 2022, 5:14 PM
Rayan Chan
Rayan Chan - avatar
+ 4
Sanjay Kamath Thank you🙃 That is bonus info🤩.. But, when do we use elif ?
14th Apr 2022, 5:17 PM
Rayan Chan
Rayan Chan - avatar
+ 3
Abhi Varshini Thank you 🤩
14th Apr 2022, 11:12 AM
Rayan Chan
Rayan Chan - avatar
+ 3
Abhi Varshini Thanks.. i got it now 🙃♥️
14th Apr 2022, 11:15 AM
Rayan Chan
Rayan Chan - avatar
+ 3
White spaces are 3 types.., 1) newline 2) tab space 3) normal space
16th Apr 2022, 2:37 AM
VENKATA SRINIVAS KATTA
VENKATA SRINIVAS KATTA - avatar
+ 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")
16th Apr 2022, 8:44 AM
Andrew Musanyera
Andrew Musanyera - avatar
14th Apr 2022, 4:51 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 2
Rayan Chan elif stands for else if. The structure is if..elif..else.
15th Apr 2022, 1:17 AM
Sanjay Kamath
Sanjay Kamath - avatar
+ 2
White spaces are missing... You know bro it's python, it's very strick at white spaces unlike cpp or java.
15th Apr 2022, 3:07 AM
Anshul Khangar
Anshul Khangar - avatar
15th Apr 2022, 6:36 AM
b̶l̶a̶n̶k̶
b̶l̶a̶n̶k̶ - avatar
+ 2
Anshul Khangar Thanks for the info.. If I can ask.. What are the white spaces?🤔 And when do we use them?
15th Apr 2022, 9:19 AM
Rayan Chan
Rayan Chan - avatar
+ 2
Sometimes \n is important
15th Apr 2022, 11:06 AM
b̶l̶a̶n̶k̶
b̶l̶a̶n̶k̶ - avatar
+ 2
VENKATA SRINIVAS KATTA Oooh!!, So they called white spaces!! Thanks 😆
16th Apr 2022, 3:32 AM
Rayan Chan
Rayan Chan - avatar
16th Apr 2022, 5:57 AM
aewerdev
aewerdev - avatar
+ 1
Andrew Musanyera Hmm.. that's right.. thanks, 😆
16th Apr 2022, 10:56 AM
Rayan Chan
Rayan Chan - avatar