Skip to content

Instantly share code, notes, and snippets.

@bobo
Forked from anonymous/gist:3775688
Created September 24, 2012 12:49
Show Gist options
  • Save bobo/3775798 to your computer and use it in GitHub Desktop.
Save bobo/3775798 to your computer and use it in GitHub Desktop.
# -*- coding: iso-8859-15 -*-
import sys
month=input ("Skriv in ett månadsnummer:")
if(month<1):
print "fealktig månad"
sys.exit(0)
day=input ("Skriv in ett dagnummer inom månaden:")
if(day<1):
print "felaktig dag"
sys.exit(0)
long_months = [1,3,5,7,8,10,11]
short_months = [4,6,9,11]
if month in long_months and day<32:
print "Korrekt"
elif month in short_months and day<31:
print "Korrekt"
elif month==2 and day<29:
print "Korrekt"
else:
print "Felaktigt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment