subject

In this project, you will gain experience with many of the Python elements you’ve learned so far, including functions, decision structures, repetition structures ("loops"), Boolean logic, the random number module, accumulators, working with files, and exception handling. 2. PROBLEM DEFINITION Phase I. Your program will generate 50 random integers in the range of 0 – 10 (inclusive). Each number will be written to a separate line of an empty file. Name the file integer_list. txt. Close the file. Phase II. Next, open the file you just created and, within a loop, read each number. For each number, apply the processing rules given below. These rules specify how to change an accumulator that is initialized to zero before the processing begins. The three rules are: (a.) Integers occurring on odd-numbered lines will be added to the accumulator. (b.) Integers occurring on even-numbered lines will be divided by the preceding value (unless that number is 0, see rule "c".) using integer division (// not /), and the resulting integer will be added to the accumulator. (c.) When integers occurring on even-numbered lines have a preceding value of 0, your program will add the line number to the accumulator. Finally, output the value of the accumulator and then exit.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:00
What are procedures that keep a data base current
Answers: 1
question
Computers and Technology, 22.06.2019 18:00
When is it appropriate to use an absolute reference
Answers: 1
question
Computers and Technology, 22.06.2019 22:50
Which is the best minecraft server? a. mineplex b. worldonecraft c. 9b9t d. 2b2t
Answers: 2
question
Computers and Technology, 24.06.2019 09:00
Why might you chose to crest a function resume
Answers: 1
You know the right answer?
In this project, you will gain experience with many of the Python elements you’ve learned so far, in...
Questions
question
Chemistry, 05.05.2020 21:31
question
Mathematics, 05.05.2020 21:31
question
Social Studies, 05.05.2020 21:31
question
Mathematics, 05.05.2020 21:31
Questions on the website: 13722362