+ 1
I'm having huge problems with using indentation and integer input.
10 ответов
+ 3
The elif statement should align with the if statement, tried this:
https://code.sololearn.com/cj9YZCAXxAsJ/?ref=app
+ 2
Can you attach your code here ?
Then it would be much easier for everyone to understand your problem.
+ 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
+ 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
+ 2
Tsholofelo your latest code is working absolutely fine. It might be an internet issue.
+ 2
Tsholofelo Yes, you should enter an integer (e.g. 5) and see what happens.
+ 1
Thank you I tried that but still results in error
https://code.sololearn.com/cr9oN4Fo9LbM/?ref=app
+ 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
0
Thank you very much guys but now it results in error syntax
https://code.sololearn.com/cr9oN4Fo9LbM/?ref=app
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?