Author name: PythonCSIP CS IP

5. Write a program that asks the user the day number in a year in the range 2 to 365 and asks the first day of the year – Sunday or Monday or Tuesday etp. Then the program should display the day on the day-number that has been input.

# Code x = int(input(‘Enter day number between 2 & 365 : ‘)) d = input(‘Enter first day of the year : ‘) l = [‘Sunday’, ‘Monday’, ‘Tuesday’, ‘Wednesday’, ‘Thursday’, ‘Friday’, ‘Saturday’] print(l[l.index(d) + x%7 – 1]) # index() finds the index of d in the list l, x%7 because days are same every 7 […]

5. Write a program that asks the user the day number in a year in the range 2 to 365 and asks the first day of the year – Sunday or Monday or Tuesday etp. Then the program should display the day on the day-number that has been input. Read More »

6. One foot equals 12 inches. Write a function that accepts a length written in feet as an argument and returns this length written in inches. Write a second function that asks the user for a number of feet and returns this value. Write a third function that accepts a number of inches and displays this to the screen. Use these three functions to write a program that asks the user for a number of feet and tells them the corresponding number of inches.

# Code def feet_to_inches(x): return x*12 def feet(): x = int(input(‘Enter feet : ‘)) return x def disp_inches(x): print(‘Number of inches :’, x) x = feet() x = feet_to_inches(x) disp_inches(x)

6. One foot equals 12 inches. Write a function that accepts a length written in feet as an argument and returns this length written in inches. Write a second function that asks the user for a number of feet and returns this value. Write a third function that accepts a number of inches and displays this to the screen. Use these three functions to write a program that asks the user for a number of feet and tells them the corresponding number of inches. Read More »