python programming

User Generated

WFzvguJevgvat

Programming

Description

P1 write your pseudo code first and then write the Python code that implements it.

** below is a suggested way to do this -- there are other ways such as setting up 2-D arrays)

Using the format of P1, set up four arrays of student scores

assume 10 questions

and 4 students.( this will illustrate the approach without too many numbers

Write a function to populate a student score array.

Populate these student arrays with zeros ( false) and 1s ( true), as their scores .

See problem 6 (UNDER THIS) and use that random function not including the

integer '1'. (instead of 'coin' flips this slightly modified random number generator

Integer(Random * 2) ( check out the Python equivalent

will simply yield 0, or 1, which is what you want).

Now manipulate those 4 arrays to answer Jones' questions

PROBLEM (6) -Develop a solution to flip a coin a given amount of times and then print the number of heads and the number of tails. The equation to toss the coin is

Coin=Integer(Random* 2) + 1

When Coin 1 the toss is heads, and when Coin 2 the toss is tails. Random returns a number between 0 and 1, including 0 but not 1. Therefore, when Random is less than 0.5, Coin will equal 1 and when Random is greater than or equal to 0.5 and less than 1, Coin willequal2

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Here are the two p...


Anonymous
I was stuck on this subject and a friend recommended Studypool. I'm so glad I checked it out!

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags