+ 1

I'm having huge problems with using indentation and integer input.

https://code.sololearn.com/cr9oN4Fo9LbM/?ref=app

20th Jul 2020, 5:34 AM
Tsholofelo
Tsholofelo - avatar
10 Respostas
+ 3
The elif statement should align with the if statement, tried this: https://code.sololearn.com/cj9YZCAXxAsJ/?ref=app
20th Jul 2020, 5:59 AM
æŽç«‹ćš
+ 2
Can you attach your code here ? Then it would be much easier for everyone to understand your problem.
20th Jul 2020, 5:37 AM
Arsenic
Arsenic - avatar
+ 2
If your problem is stemmed from this code, https://code.sololearn.com/cr9oN4Fo9LbM/?ref=app, just use the elif or else keyword in Python. e.g. age=int(input('age please?')) if age>=18: print('you can party') elif age<18: #use elif here print('too young') #indentation aligned with the previous print statement
20th Jul 2020, 5:39 AM
æŽç«‹ćš
+ 2
You can either use elif statement like æŽç«‹ćš said or just bring the second *if* statement out of first one by removing that extra indentation Here is the fix 👇 https://code.sololearn.com/cggOncux8h6v/?ref=app
20th Jul 2020, 5:45 AM
Arsenic
Arsenic - avatar
+ 2
Tsholofelo your latest code is working absolutely fine. It might be an internet issue.
20th Jul 2020, 6:06 AM
Arsenic
Arsenic - avatar
+ 2
Tsholofelo Yes, you should enter an integer (e.g. 5) and see what happens.
20th Jul 2020, 6:17 AM
æŽç«‹ćš
+ 1
Thank you I tried that but still results in error https://code.sololearn.com/cr9oN4Fo9LbM/?ref=app
20th Jul 2020, 6:05 AM
Tsholofelo
Tsholofelo - avatar
+ 1
Tsholofelo đŸ€Šâ€â™‚ïž that pop up message was asking you for the input that you have to give to the program. If you left it empty that means you are not giving any input in your code. just see this tutorial (by running the code) to know how input is handled on sololearn 👇 https://code.sololearn.com/WhiNb9BkJUVC/?ref=app
20th Jul 2020, 6:18 AM
Arsenic
Arsenic - avatar
0
Thank you very much guys but now it results in error syntax https://code.sololearn.com/cr9oN4Fo9LbM/?ref=app
20th Jul 2020, 5:57 AM
Tsholofelo
Tsholofelo - avatar
0
When I press run, the program pops up a message telling me that my program needs input and that I should split multiple strings into separate lines. And I don't enter anything. So could that be the problem?
20th Jul 2020, 6:15 AM
Tsholofelo
Tsholofelo - avatar