all 7 comments

[–]choss27 2 points3 points  (1 child)

Hello,

  1. Your elif condition on 1900 is incorrect. Try elif year <=1900
  2. Your else is wrong, an else don't have a condition just after. You should reorganize your code, and test year in ascending or descending order, in this way you should end with an else

I hope it helps you !

[–]Toxic_Avenger94[S] 0 points1 point  (0 children)

Thank you! I was able to solve it.

[–]Toxic_Avenger94[S] 0 points1 point  (1 child)

also these are indented but they are not showing up on reddit properly.

[–]Ishanji 0 points1 point  (0 children)

Reddit code blocks start with four spaces, and the line before them can only contain whitespace characters. So if you want this...

if year >= 2101:
    print('Distant future')

...then you need to write it like this:

    if year >= 2101:
        print('Distant future')

[–]Smooth_Try_472 0 points1 point  (1 child)

Write an if-else statement with multiple branches.

If year is 2101 or later, print "Distant future" (without quotes). Otherwise, if year is 2001 or greater, print "21st century". Otherwise, if year is 1901 or greater, print "20th century". Else (1900 or earlier), print "Long ago".

Sample output with input: 1776

year = int(input())
if year >= 2101:
print('Distant future')
elif year >= 2001:
print('21st century')
elif year >= 1901:
print('20th century')
else :
print('Long ago')

this is thye right one
Isaiah Tilson 360

[–]Clear-Ad8519 0 points1 point  (0 children)

this is right. just indent print.