Computers and Technology

Use python "files and exceptions"

1- modify the program you wrote for chapter 6 exercise 6 so it handles the following
exceptions:
• it should handle ioerror exceptions that are raised when the file is opened
and data is read from it by printing "trouble opening file. try again." and
not executing any more of the code.
• it should handle any valueerror exceptions that are raised when the items
that are read from the file are converted to a number by printing "file must have
only numbers. try again." and not executing any more of the code.

2- the springfork amateur golf club has a tournament every weekend. the club
president has asked you to write a program that will read each player's name
and score as keyboard input, and then save these as records in a file named
golf. txt.

first, have the program ask the user how many players they want to add to their
record. then, ask the user for each name and score individually.

golf. txt should be structured so that there is a line with the player's name,
folowed by their score on the next line.

emily
30
mike
20
jonathan
23

3- write a program that reads the records from the golf. txt file written in exercise
10a and prints them in the following format:

name: emily
score: 30

name: mike
score: 20

name: jonathan
score: 23

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 04:00, yolo1430
Acetylene is a gas which burns rapidly on its own, and is considered highly explosive. a) true b) false
Answers: 2
image
Computers and Technology, 22.06.2019 17:30, uh8hardiek
Ou listened to a song on your computer. did you use hardware or software?
Answers: 2
image
Computers and Technology, 23.06.2019 17:00, osirisarellane3792
*! 20 points! *jeff wants to create a website with interactive and dynamic content. which programming language will he use? a. dhtml b. html c. css d. javascript
Answers: 1
image
Computers and Technology, 23.06.2019 19:00, jaymc1932
Whose task it is to ensure that the product flows logically from one step to another?
Answers: 3
Do you know the correct answer?
Use python "files and exceptions"

1- modify the program you wrote for chapter 6 exercise...

Questions in other subjects:

Konu
Mathematics, 15.01.2020 02:31