1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Leona [35]
3 years ago
14

Write a program that will print out statistics for eight coin tosses. The user will input either an "h" for heads or a "t" for t

ails for the eight tosses. The program will then print out the total number and percentages of heads and tails. Use the increment operator to increment the number of tosses as each toss is input. For example, a possible sample dialog might be: For each coin toss enter either ‘h’ for heads or ‘t’ for tails. First toss: h Second toss: t Third toss: t Fourth toss: h Fifth toss: t Sixth toss: h Seventh toss: t Eighth toss: t Number of heads: 3 Number of tails: 5 Percent heads: 37.5 Percent tails: 62.5
Computers and Technology
1 answer:
shusha [124]3 years ago
3 0

Answer:

Written in Python

head = 0

tail = 0

for i in range(1,9):

     print("Toss "+str(i)+": ")

     toss = input()

     if(toss == 'h'):

           head = head + 1

     else:

           tail = tail + 1

print("Number of head: "+str(head))

print("Number of tail: "+str(tail))

print("Percent head: "+str(head * 100/8))

print("Percent tail: "+str(tail * 100/8))

Explanation:

The next two lines initialize head and tail to 0, respectively

head = 0

tail = 0

The following is an iteration for 1 to 8

<em>for i in range(1,9): </em>

<em>      print("Toss "+str(i)+": ") </em>

<em>      toss = input()  </em><em>This line gets user input</em>

<em>      if(toss == 'h'):  </em><em>This line checks if input is h</em>

<em>            head = head + 1 </em>

<em>      else:  </em><em>This line checks otherwise</em>

<em>            tail = tail + 1 </em>

The next two lines print the number of heads and tails respectively

print("Number of head: "+str(head))

print("Number of tail: "+str(tail))

The next two lines print the percentage of heads and tails respectively

print("Percent head: "+str(head * 100/8))

print("Percent tail: "+str(tail * 100/8))

You might be interested in
Which program will have the output shown below?
Ipatiy [6.2K]

Answer: >>> for count in range(10, 14):

   print(count)

Explanation:

just took the test on edg

4 0
3 years ago
Read 2 more answers
Which of the following is the correct order for arranging these titles in a subject filing system? A. Applications, Banking Serv
Ket [755]

Answer:

The correct answer is option (A) Applications, Banking Services, Customer Service

Explanation:

Solution

Methods of filing

There are 5 methods of filing:

• Filing by Subject/Category

• Filing in Alphabetical order

• Filing by Numbers/Numerical order

• Filing by Places/Geographical order

• Filing by Dates/Chronological order

In this case, we can fill by Alphabetical order which is given below

Applications, Banking Services, Customer Service

7 0
3 years ago
What linux command displays the ip address and subnet mask?
Nookie1986 [14]
Type "ifconfig" at the terminal prompt, then press the "Enter" key. The IP address is labeled as "inet addr." The subnet is labeled as "Mask."

step 2

Type "netstat -r" at the command prompt, then press the "Enter" key to view the gateway address.

3 0
3 years ago
HELP ASAP DUE IN 10 MINUTES!!! HELP!!!!!<br> Problem solver<br> Logical<br> Innovative
marshall27 [118]
The first one is problem solver, the second one is Innovative, and the third one is logical.
6 0
3 years ago
Read 2 more answers
Teaching Siri or the Google Assistant how to recognize your voice by reading to it is an example of ________.
nata0808 [166]

Answer:

4. Supervised learning.

Explanation:

Supervised and Unsupervised learning are both learning approaches in machine learning. In other words, they are sub-branches in machine learning.

In supervised learning, an algorithm(a function) is used to map input(s) to output(s). The aim of supervised learning is to predict output variables for given input data using a mapping function. When an input is given, predictions can be made to get the output.

Unsupervised learning on the other hand is suitable when no output variables are needed. The only data needed are the inputs. In this type of learning, the system just keeps learning more about the inputs.

Special applications of supervised learning are in image recognition, speech recognition, financial analysis, neural networking, forecasting and a whole lot more.

Application of unsupervised learning is in pre-processing of data during exploratory analysis.

<em>Hope this helps!</em>

8 0
2 years ago
Other questions:
  • Which of the following translates packets so that the node can understand them once they enter through a port?
    8·2 answers
  • A short-circuit evaluation is where each part of an expression is evaluated only as far as necessary to determine whether the en
    14·1 answer
  • Which sentences in the passage correctly describe a function?
    11·1 answer
  • Project introduction​
    14·1 answer
  • Hey! PLEASE HELP!!!
    12·1 answer
  • HELP ME PLEASE !!!!!!!!!!
    6·1 answer
  • Use the {blank} to view your presentation the way an audience will see it.
    13·2 answers
  • Ania has written this SimpleStopwatch class. In which line is she measuring the elapsed time?
    13·1 answer
  • besides entering a url to go directly to a website, what else can you enter in a browser address bar to explore the internet?
    10·1 answer
  • processing C. have only one function, e.g. control traffic lights in a town, games machines 7 To create a formula, you first: A.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!