subject

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

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 22.06.2019 17:40
Write a modular program (no classes yet, just from what you learned last year), that allows two players to play a game of tic-tac-toe. use a two-dimensional char array with 3 rows and 3 columns as the game board. each element of the array should be initialized with an asterisk (*). the program should display the initial board configuration and then start a loop that does the following: allow player 1 to select a location on the board for an x by entering a row and column number. then redisplay the board with an x replacing the * in the chosen location. if there is no winner yet and the board is not yet full, allow player 2 to select a location on the board for an o by entering a row and column number. then redisplay the board with an o replacing the * in the chosen location. the loop should continue until a player has won or a tie has occurred, then display a message indicating who won, or reporting that a tie occurred. player 1 wins when there are three xs in a row, a column, or a diagonal on the game board. player 2 wins when there are three ox in a row, a column, or a diagonal on the game board. a tie occurs when all of the locations on the board are full, but there is no winner. input validation: only allow legal moves to be entered. the row must be 1, 2, or 3. the column must be 1, 2 3. the (row, column) position entered must currently be empty (i.e., still have an asterisk in it).
Answers: 1
question
Computers and Technology, 22.06.2019 21:50
Given int variables k and total that have already been declared, use a while loop to compute the sum of the squares of the first 50 counting numbers, and store this value in total. thus your code should put 11 + 22 + 33 + + 4949 + 50*50 into total. use no variables other than k and total.
Answers: 2
question
Computers and Technology, 23.06.2019 18:30
Janice recently received her college degree and is looking for a job. she is worried that since she just finished school, she will be required to repay her perkins and direct subsidized loans immediately. janice pulls out the paperwork she signed and reviews it again for repayment information. after reading all of the information, janice discovers that
Answers: 2
You know the right answer?
Use python "files and exceptions"

1- modify the program you wrote for chapter 6 exercise...
Questions
question
Social Studies, 02.12.2020 23:30
question
Mathematics, 02.12.2020 23:30
question
English, 02.12.2020 23:30
question
Mathematics, 02.12.2020 23:30