Print out a date, given year, month, and day as numbers,givennumbers,months = [
Print out a date, given year, month, and day as numbers,givennumbers,months = [
months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']# A list with one ending for each number from 1 to 31endings = ['st', 'nd', 'rd'] + 17 * ['th'] \ + ['st', 'nd', 'rd'] + 7 * ['th'] \ + ['st']year = raw_input('Year: ')month = raw_input('Month (1-12): ')day = raw_input('Day (1-31): ')# Remember to subtract 1 from month and day to get a correct indexmonth_name = months[int(month)-1]ordinal = day + endings[int(day)-1]print month_name + ' ' + ordinal + ', ' + year
- Define and ouuput string: 8-bit, 1-byte, 2-byte and 4-by
- Random int value,randomintvalue,import rando
- Reflection: Find the data type,reflectionfind,from typ
- Sort stdin input lines and send result to stdout,stdin
- sys.stdin.readline() with out error check,,import sys,
- Link Python system error stream into a file,pythonstre
热门文章:
相关内容
- Define and ouuput string: 8-bit, 1-byte, 2-byte and 4-byte,ouuput1-
- Random int value,randomintvalue,import rando
- Reflection: Find the data type,reflectionfind,from types i
- Sort stdin input lines and send result to stdout,stdinstdout,import
- sys.stdin.readline() with out error check,,import sys,
- Link Python system error stream into a file,pythonstream,import sys
- Getting user input,gettinguserinput,name = raw_i
- Catch exception throwed inside a function,exceptionthrowed,def f():
- Using the continue statement in a for/in structure.,statementstruct
- Divided by int or by float,dividedfloat,from __futur
评论关闭