0

What is wrong in this code?

a=100 b=20 if(a>b) Print(a) Else Print(b)

12th Jan 2021, 5:54 AM
Nikita Dua
Nikita Dua - avatar
4 Answers
+ 6
if(a>b): else: You forgot ":" "else" and "print" - from small letters
12th Jan 2021, 5:59 AM
Igor Kostrikin
Igor Kostrikin - avatar
+ 5
Nikita Dua you forgot the colons (:) no parentheses in a>b Change Else to else Change Print to print Correct Code: a = 100 b = 20 if a > b: print(a) else: print(b)
12th Jan 2021, 5:58 AM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
+ 2
#this is corrected: a=100 b=20 if(a>b): print(a) else: print(b)
12th Jan 2021, 6:13 AM
Shadoff
Shadoff - avatar
+ 1
Nikita Dua In python, : and indentations are very important. 1. You forgot to add : after your if/else. 2. print starts with lowercase 'p'. Just make these changes and your code will work fine.. It happens to all programmers. Keep practicing and you will learn to self-correct such syntactical errors.
12th Jan 2021, 6:02 AM
CHANDAN ROY
CHANDAN ROY - avatar