Computers and Technology

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.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 16:50, Tyrant4life
Consider a slotted aloha system, where the time slot equals the fixed duration of each packet. assume that there are 4 stations a, b,c, d sharing the medium. (a) stations a, b,c, d receive one packet each from higher layers at times 1.3, 1.5, 2.6,5.7 respectively. show which transmissions take place when, according to the slottedaloha protocol; describe all transmissions until all four packets have been successful. when needed, each station has access to the following sequence of random number, provided by a random number generator and drawn uniformly between 0 and 1: (1) station a draws numbers: 0.31, 0.27, 0.78, 0.9, 0.9, 0.11, 0. (2) station b draws numbers: 0.45, 0.28, 0.11, 0.83, 0.37, 0.22, 0. (3)station c draws numbers: 0.1, 0.2, 0.3, 0.4, 0. (4) station d draws numbers: 0.36, 0.77, 0.9, 0.1, 0.1, 0.1, 0.1, 0. (b) in slotted aloha, a station transmits in each time slot with a given probability. what probabilities would you assign to each of the four stations so as to: (i) maximize the efficiency of the protocol? (ii) maximize fairness among the four stations? (c) will the efficiency increase or decrease if we modify slotted aloha as follows: (i) get rid of slots and allow stations to transmit immediately? (ii) implement carrier sensing? (iii) implement collision detection? (iv) implement collision avoidance?
Answers: 3
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 16:10, alexis9658
What is the ooh? a. omaha occupation handbook b. online occupational c. occupations online d. occupational outlook handbook select the best answer from the choices provided
Answers: 3
image
Computers and Technology, 23.06.2019 20:00, noah12345678
What multimedia system creates an immersive, real-life experience that the user can interact with?
Answers: 1
Do you know the correct answer?
In this project, you will gain experience with many of the Python elements you’ve learned so far, in...

Questions in other subjects:

Konu
English, 18.05.2021 03:10