year = int(input("Enter a year: "))
if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
print("The year", year, "is a leap year")
else:
print("The year "+str(year)+" is not a leap year") # another way to format a message with variables
Created
March 16, 2025 22:22
-
-
Save miquelvir/165414abf858ba59164bc04e9991fc38 to your computer and use it in GitHub Desktop.
devQuest - 16/03/2025 23:21
# Version with ord() and chr()
character = ord(input("Enter a character (will crash if you enter more than one)"))
if ord('a') <= character <= ord('z'):
print('The letter', chr(character), 'is lowercase')
elif ord('A') <= character <= ord('Z'):
print('The letter', chr(character), 'is uppercase')
elif ord('0') <= character <= ord('9'):
print(chr(character), 'is a number')
else:
print(chr(character), 'is a symbol')
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment