+ 2

Where is the error?

City=1200 Town=1199 If city<1200: Print ("it's a Town") If Town>1199: Print ("it's a City")

3rd Apr 2022, 12:37 AM
Al-amin Muhammad
Al-amin Muhammad - avatar
5 Réponses
+ 5
Al-amin Muhammad You have already received some good answers, but I would like to point out that you need an input to compare against your conditions, ( & you only need 1 condition) population = int(input()) city = 1200 if population < city: print("Town") else: print("City")
3rd Apr 2022, 2:57 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 4
Presuming you have corrected the capitalization errors, let's look at the logic... City=1200 Town=1199 if City<1200: #<--false print ("it's a Town") if Town>1199: #<--false print ("it's a City") Both conditions are false, therefore there will be no output.
3rd Apr 2022, 12:50 AM
Brian
Brian - avatar
+ 3
1. As I see you use capital letters Change "If" to "if" and "Print()" to "print()" 2. indentation to second print is wrong, make sure you type this right 3. also you set variable City but use city in if statement. 4. Then you check are something bigger or lower (City and Town) but thay are equal so, your if wont run at all.
3rd Apr 2022, 12:42 AM
PanicS
PanicS - avatar
+ 3
IF and PRINT should be in lower case
3rd Apr 2022, 7:58 AM
Yusra
Yusra - avatar
+ 2
Al-amin Muhammad Problem is with conditions if city = 1200 then city can't be less than 1200 1200 < 1200 #both values are same then how can be less than Same for 1199
3rd Apr 2022, 2:25 AM
A͢J
A͢J - avatar