Print out a date, given year, month, and day as numbers : Assignment : List PYTHON TUTORIALS


PYTHON TUTORIALS » List » Assignment »

 

Print out a date, given year, month, and day as numbers


months = [
    'January',
    'February',
    'March',
    'April',
    'May',
    'June',
    'July',
    'August',
    'September',
    'October',
    'November',
    'December'
]

# A list with one ending for each number from to 31
endings = ['st', 'nd', 'rd'] 17 ['th'] 
        ['st', 'nd', 'rd'] +  ['th'] 
        ['st']

month_number = 8
day_number = 1

month_name = months[month_number-1]
ordinal = endings[day_number-1]

print month_name 
print ordinal



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo List
» Assignment