General information/requirements/grading rules
- Adhere to the naming conventions discussed in class for variable names, program name and function names
- Use meaningful names for variables
- If there are two words in the variable use first word lowercase and first letter of second wordupper case i.e., firstName or underscore between 2 words i.e first_name
- Include appropriate comments in the code
- Output should be displayed exactly as mentioned against each problem
- Indent the lines of code appropriately
1.numeric.py (20 Points)
Write a program that prompts the User to enter a number between the range of 1 through 10. The program should display the Roman Numeral version of that number. If the number is outside the the range of 1 through 10, the program should display the error message. The output should display the data in table as shown below:
Hints:
Prompt user to enter a number.
Use a ‘if /elif’ to verify if the number entered is within the range and display output accordingly.
If the number is out of range, display the following error message : ”Error: Invalid Number’.
Output should look like:
Number Roman Numeral
1 I
2 II
3 III
4 IV
5 V
6 VI
7 VII
8 VIII
9 IX
10 X
- dollar.py (30 Points)
Write a program that finds number of Dollars, quarters, dimes, nickels, pennies given an amount.
Hints:
Prompt user to enter an amount
Find number of one dollars (remember to convert total amounts to pennies)
Find number of quarters in the remaining amount
Find number of dimes in the remaining amount
Find number of nickels in the remaining amount
Find number of pennies in the remaining amount
Display results
Expected Output:
Your amount 10.63 consists of
10 dollars
2 quarters
1 dimes
0 nickels
3 pennies
3. dates.py (20 Points)
Design a program that asks the user to enter a month (in numeric form), a day, and a 2 digit year. The program should then determine whether the month * day is equal to the year. If so, it should display a message saying the date is magic. Otherwise, it should display a message saying the date not magic.
Hint:
Prompt user to the month, day, and year in two digit format
Verify the month input if it is between 1 and 12. Display error message otherwise.
Verify the day input if it is between 1 and 31. Display error message otherwise.
Verify the year input if it is between 0 and 99. Display error message otherwise.
If the inputs are valid, evaluate the magic date.
Expected output:
If user enters a month as 7, day as 3, year as 21, the it should display as follows:
The date is 7 / 3 / 21
This is a magic date.
4. leapYear.py (30)
Write a program that asks the User to enter a year. The program should display the number of days in February that year. Use the following criteria to identify leap years:
1. Determine whether the year is divisible by 100. If it is, then it is a leap year and if only if it is also divisible by 400. For example,
2000 is a leap year but 2100 is not.
2. If the year is not divisible by 100, then it is a leap year and if only if it is also divisible by 4. For example,
2008 is a leap year but 2009 is not.
Hints:
Prompt user to enter a year
Use nested if to verify if the year is divisible by both 100 & 400
determine if the leap year is ‘True or False’
Use Else to o verify if the year is divisible by 4 (if year %4 == 0: )
determine if the leap year is ‘True or False’
Now use IF and Else to print if the year entered is a leap year or not.
Output
If entered 2008, the output should display: That is a leap year. February has 29 days.
If entered 2009, the output should display: That is not a leap year. February has 28 days.