Question: This is the code I have and it's giving me a syntax error on the equals sign inside the print statement right after end. Write
This is the code I have and it's giving me a syntax error on the equals sign inside the print statement right after end.
Write a python script that asks (prompts) the user to input three student names and their ID numbers one at a time using the keyboard, and stores each name and id in a dictionary in three separate entries. Then writes each entry of the dictionary in a text file called student_records.txt. For instance an example of the "student_records.txt" text file can Assignment.py Assignment.py Student Records: Name1: Alex ID1: 101 Name2: Brian ID2: 102 Name2: Michael ID2: 103 #code. ?? 2 try d dict() for x in range(1,4): 4 print("Name",x,": ",end -"") name input() print("ID", x, ": ",end-") id input() d [name] id 7 out open ("student_records.txt", "w") lineNumber1 for x in d: 10 12 13 14 15 16 17 18 except Exception: 19 out.write(x) out.write("\t") out.write (d[x]) out.write(" ") out.close() print("File doesn't exist")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
