Created
October 25, 2018 07:13
-
-
Save piyush2896/44b414333111e4023d5e19750def8dee to your computer and use it in GitHub Desktop.
Assignments for blog post https://predictiveprogrammer.com/intro-to-programming-with-python-2/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
no = int(input('Enter a positive number: ')) | |
if no % 2 == 0: | |
print(no, 'is even.') | |
else: | |
print(no, 'is odd') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
year = int(input('Enter an year: ')) | |
if year % 4 == 0: | |
if year % 100 == 0: | |
if year % 400 == 0: | |
print('Year', year, 'is a leap year') | |
else: | |
print('Year', year, 'is not a leap year') | |
else: | |
print('Year', year, 'is a leap year') | |
else: | |
print('Year', year, 'is not a leap year') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment