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 04:30
There is a simple pattern for determining if a binary number is odd. what is it and why does this pattern occur? how many bits would you need if you wanted to have the ability to count up to 1000? how high could you count in binary if you used all 10 of your fingers as bits? (finger up means 1, finger down means 0)
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
Kto rozmawia z clamentain przez krótkofalówke w the walking dead w 4 epizodzie
Answers: 1
question
Computers and Technology, 24.06.2019 01:00
Me if you do then you get 10 points and brainliest
Answers: 1
question
Computers and Technology, 24.06.2019 11:00
Why is it uncommon for users to perform searches directly in database tables? a.)users are discouraged from interacting directly with tables because they might confuse tables with spreadsheets. b.) users are discouraged from interacting directly with tables because this may result in unintended changes to source data. c.)users do not have the technical skills required to perform searches directly in database tables. d.)users do not have the permissions required to perform searches directly in database tables.
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
Mathematics, 08.04.2021 20:30
question
Chemistry, 08.04.2021 20:30
Questions on the website: 13722359