+ 13
What is wrong in this code?
a=int(input('enter the number') if a%2==0 and a>100: print(a,'is an even number and is also greater than 100')
50 odpowiedzi
+ 6
Fixed the parenthesis and the indentation.
https://code.sololearn.com/cVZcnKoP7zFr/?ref=app
+ 18
The indentation.
And a missing closing parenthesis in line 1.
+ 5
Indentation is a way to structure code (other languages use parentheses or curly braces to do that).
When you indent a line you tell python that it is subordinate to another one. Examples are loops and if-elif-else structures. You have to tell python which lines should be executed multiple times (loops) or under particular conditions (if-elif-else). When you unindent a line you tell python that it is not subordinate.
+ 3
Look at your first line.
Bracket missing.
The exactly code will be
a= int(input ('enter the number'))
+ 3
Simon Sauter Additional contents are always helpful
+ 2
Welcome to the club ,bro😂
+ 2
error handling is also very important, try/except should help incase of ValueError
+ 1
It is still showing error Simon
+ 1
What's the error message?
+ 1
File "file0.py", line 2 if a%2==0 and a>100:
A IndentationError: unexpected indent
+ 1
Indentation is literally the first thing I mentioned. See my code for the correct indentation.
+ 1
Missing bracket in line 1
+ 1
Ghasaq Ali
1. The question has been resolved five days ago. See the comments above for details.
2. There is no loop in the code, let alone an infinite one.
0
Thank you Simon
0
Can you teach me coding please simon
0
No. But that's what the sololearn courses are for. And when you run into specific issues you can always post another question.
0
Which class are you in and where you live can you tell please if you don't mind
0
As you can see when you click on my profile picture I am from Germany. I'm not in school anymore, I already graduated from university.
0
From when you have started coding