+ 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")
5 Antworten
+ 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")
+ 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.
+ 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.
+ 3
IF and PRINT should be in lower case
+ 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