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')
Fixed the parenthesis and the indentation. https://code.sololearn.com/cVZcnKoP7zFr/?ref=app
The indentation. And a missing closing parenthesis in line 1.
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.
Look at your first line. Bracket missing. The exactly code will be a= int(input ('enter the number'))
Simon Sauter Additional contents are always helpful
Welcome to the club ,bro😂
error handling is also very important, try/except should help incase of ValueError
It is still showing error Simon
What's the error message?
File "file0.py", line 2 if a%2==0 and a>100: A IndentationError: unexpected indent
Indentation is literally the first thing I mentioned. See my code for the correct indentation.
Missing bracket in line 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.
Thank you Simon
Can you teach me coding please simon
No. But that's what the sololearn courses are for. And when you run into specific issues you can always post another question.
Which class are you in and where you live can you tell please if you don't mind
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.
From when you have started coding