[Solved] SOLVED:HW2 Write a program called isleapyear.py Solution

30 $

File Name: SOLVED:HW2_Write_a_program_called_isleapyear.py_Solution.zip
File Size: 527.52 KB

SKU: [Solved] SOLVED:HW2 Write a program called isleapyear.py Solution Category: Tag:

Or Upload Your Assignment Here:


Restrictions:1. You must have at least 1 user defined function per problem.2. You may not use global variables.1. (Time: 5 mins) Write a program called isleapyear.py that asks the user to enter a year and then tells them if it is a leap year or not. Please view this website to see what makes a leap year a leap year.◦ Example 1:Please enter a year: 20002000 is a leap year.◦ Example 2:Please enter a year: 19901990 is not a leap year.2. (Time: 13 mins) You are designing the new front end interface for the registrar to enter new students into their data base. Write a program called enter_registrar.py that asks the user for astudent’s first name, last name, and their date of enrollment. The date of enrollment will be entered as: MonthName day, Year. Your program will then output the following fixed width stringLLLLLLLLLLFFFFFFFFFFMM/DD/YY1. L stands for the persons last name. If the student’s last name is too long it should be truncated down to 10 characters. If the student’s last name is less than 10 characters then ‘-‘ should be added to the end of their last name until it is 10 characters long.2. F stands for the persons first name. If the student’s first name is too long it should be truncated down to 10 characters. If the student’s first name is less than 10 characters then ‘-‘ should be added to then end of their first name until it is 10 characters long.3. M stands for the month4. D stands for the day of the month5. YY stands for the last 2 digits of the year• Example 1Please enter the student’s first name: MatthewPlease enter the student’s last name: ButnerPlease enter the student’s enrollment date: September 21,2008Storing: Butner—-Matthew—09/21/08• Example 2Please enter the student’s first name: JoePlease enter the student’s last name: MaxwellsonPlease enter the student’s enrollment date: October 10,2014Storing: MaxwellsonJoe——-10/10/14• Example 3Please enter the student’s first name: AVeryLongFirstNamePlease enter the student’s last name: CanThisEvenFitPlease enter the student’s enrollment date: May 7, 1991Storing: CanThisEveAVeryLongF05/07/91• Example 4Please enter the student’s first name: AmyPlease enter the student’s last name: WuPlease enter the student’s enrollment date: April 1, 2010Storing: Wu——–Amy——-04/01/103.(Time 15 mins)Write a program called plural.py that asks the user for a noun and prints out its plural form. We will be using the following rules for making a word pluralEnds With Plural Formch, sh, s, x, or z Add esvowel and y Add sa consonant and y Y becomes iesf or fe Becomes vesAll others Add sHint: I suggest having functions that check if a letter is a vowel and another to check if a letter is a consonant.1. Examples1.Please enter a word: boyThe plural form of boy is boys.2.Please enter a word: loafThe plural form of loaf is loaves.3.Please enter a word: mooseThe plural form of moose is mooses.4. (Time: 15 mins) Write a program called frac_add that asks the user for twofractions and prints out the sum of the fractions. In this program, the user canenter anything and your program should not crash.1. Valid input is defined as follows1. Any amount of white space followed by a number followed by any amountof white space2. Any amount of white space followed by an optional negative sign followedby a number followed by any amount of white space followed by a /followed by any amount of white space followed by a positive number.3. If your program receives invalid input it should tell the user they enteredbad input and then stop the program.4. You can use exit(0) to terminate your program.2. You should NOT simplify your fractions. If however the fractions have thesame denominator you should continue use that denominator in your answer.3. Examples1.Please enter a fraction: 5 / 8Pleaes enter another fraction: 4/75/8 + 4/7 = 67/562.Please enter a fraction: 3/4Pleaes enter another fraction: 5/43/4 + 5/4 = 8/43.Please enter a fraction: 3/4Pleaes enter another fraction: bobbob is not a valid fraction. Ending program.4.Please enter a fraction: stevePleaes enter another fraction: 5/9steve is not a valid fraction. Ending program.5.Please enter a fraction: -6Pleaes enter another fraction: -4 / 36-6/1 + -4/36 = -220/366.Please enter a fraction: 3 / -4Pleaes enter another fraction: 5/-63 / -4 is not a valid fraction. Ending program

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:HW2 Write a program called isleapyear.py Solution
30 $