individual programs for 6 items 1
Submitted files must have standardized names. Project files must contain the assignment name and your name.
If your submission consists of only source code one file, use the file extension .py. Example filename: proj1smith.py. (Replace smith by your last name)
If your submission consists of multiple files, place them in a folder named proj3smith (replace smith by your last name), and create a zip file named proj3smith.zip.
Acceptable Folder Names: proj3smith Proj3smith proj3Smith Proj3Smith
Unacceptable Folder Names: smithProj3 proj3 smith Project3Smith Proj3AlbertSmith Proj3 Project3
5. Submitted files contain a header. Submitted files must contain a header with comments containing your name, the name of the assignment at the top. For example:
Stan Smith
Assignment 1a
Due Date: Jan 16
Write individual programs for the following 6 items. All programs must run by either enter a user prompt or our it’s own.
Don’t forget to do your header for each python file
Name each python file solution#_lastname. Replace # with the number of the solution this was. Put in your files into a folder named final_lastname. Replace lastname with yours. Zip the folder and turn it in D2L.
Check the Guidelines for Submissions
1. Make an inches to kilometers conversion must use input statement in your program letting me know what to do. No hard coding allowed for inches into the program.
2. Address the 4 FIXME comments.
The first two is making while loop to the create each function
The last two is to call the function.
You may NOT change any other code to the program.
def add_grade(student_grades):
print(‘Entering grade. n’)
name, grade = input(grade_prompt).split()
student_grades[name] = grade
# FIXME: Create delete_name function
# FIXME: Create print_grades function
student_grades = {} # Create an empty dict
grade_prompt = “Enter name and grade (Ex. ‘Bob A+’):n”
delete_prompt = “Enter name to delete:n”
menu_prompt = (“1. Add/modify student graden”
“2. Delete student graden”
“3. Print student gradesn”
“4. Quitnn”)
command = input(menu_prompt).lower().strip()
while command != ‘4’: # Exit when user enters ‘4’
if command == ‘1’:
add_grade(student_grades)
elif command == ‘2’:
# FIXME: Only call delete_name() here
print(‘Deleting grade.n’)
name = input(delete_prompt)
del student_grades[name]
elif command == ‘3’:
# FIXME: Only call print_grades() here
print(‘Printing grades.n’)
for name, grade in student_grades.items():
print(name, ‘has a’, grade)
else:
print(‘Unrecognized command.n’)
command = input().lower().strip()
3. Modify the program to include two-character .com names,
where the second character can be a letter or a number.
example: a2.com.
print(‘Two-letter domain names:’)
letter1 = ‘a’
letter2 = ‘?’
while letter1 <= ‘z’: # Outer loop
letter2 = ‘a’
while letter2 <= ‘z’: # Inner loop
print(‘%s%s.com’ % (letter1, letter2))
letter2 = chr(ord(letter2) + 1)
letter1 = chr(ord(letter1) + 1)
4. Write a program that reads from words.txt (which the file is attached to this project) and prints only the words with more than 20 characters (not counting whitespace). The words.txt file must be included in your zip folder you turn in.
5. Complete the PrintTicTacToe function with parameters horiz_char and vert_char that prints a tic-tac-toe board
def print_tic_tac_toe(horiz_char, vert_char):
# FIXME: complete function to print game board
return
6. In 2018, national debt in the US was 21.46 billion dollars. One projection, in theory, says the debt will rise by 6.3% every year. Write a program showing what the debt will be each year to 2035. You can use a string stating your figures are in the billions and must use 2 decimal points