Indentation error in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Indentation error in python

https://code.sololearn.com/cvsHhCa6lVXK/?ref=app anyone help me to solve this indentation error I'm a beginner to python

20th Feb 2023, 2:54 PM
maha Lakshmi
maha Lakshmi - avatar
4 Answers
+ 8
#edited part of your code , maha Lakshmi actually you have to put indentation after every if , elif statement and else other things are good👍🏻 N1=int(input()) N2=int(input()) if N1<N2: print(N2) else : print(N1) #edited instead of elif that you have used you can tooo use else in replace of elif although your required output shows but as they are TWO conditions : Use if and else only
20th Feb 2023, 3:00 PM
Suparna Das
Suparna Das - avatar
+ 7
there should one other point to consider besides the indentation issue. since we have only 2 elements to compare, we don't need an *elif* statement with a second conditional. we can use just *else:* N1=int(input()) N2=int(input()) if N1<N2: print(N2) else: print(N1)
20th Feb 2023, 7:38 PM
Lothar
Lothar - avatar
+ 3
Code indentation play important role in python u cannot avoid if you using vs code or any other ide they provide intelligence auto writing, code formatting features you can easily format your code.
20th Feb 2023, 3:10 PM
A S Raghuvanshi
A S Raghuvanshi - avatar