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]
4 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]4 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
4. What will the following line of code produce?
spayn [35]

i believe it would be "Hello there earthling".

8 0
3 years ago
Networks that are designed to connect similar computers that share data and software with each other are called:_______
sergij07 [2.7K]

Networks that are designed to connect similar computers that share data and software with each other are called: Peer to Peer (P2P) Networks.

<h3>What is a networking software?</h3>

A networking software can be defined as a set of executable instructions (codes) that is typically designed and developed to instruct a networking device on how to perform a specific task or transmit data from one location to another.

<h3>The types of networking software.</h3>

Generally, there are three main types of networking software and these include the following:

  • Security software
  • Connection software
  • Transport software

In Computer networking, Peer to Peer (P2P) Networks can be defined as a type of network that are designed and developed to connect similar computers that share data and software with each other.

Read more on Peer to Peer Networks here: brainly.com/question/1932654

#SPJ1

7 0
2 years ago
How do I translate my Flowchart into Psuedocode?
harkovskaia [24]

Answer:

Step 1

Open the flowchart and locate the startinglocation on the chart.

Step 2

Write the pseudocode that is equivalent to the rectangular process boxes in your diagram.

Step 3

Write the pseudocode for the diamond-shaped decision boxes in your diagram.

Step 4

Write the pseudocode for the end terminator of the flowchart.

Combine all of your converted statements above and you have a flowchart that has been converted to pseudocode.

8 0
3 years ago
Can someone start me off with a short 2 or 3 paragraphs about the pros and cons of Microsoft Word, and if you can recommend a si
Romashka-Z-Leto [24]
Microsoft Word is an overall very good application. It can be easily used with other Microsoft products, such as PowerPoint and Excel. However, there are some cons.

The spelling and grammar check is widely considered not very good. It does pick up many spelling errors, but many grammar errors are either not noticed, or are incorrectly noticed - it may say that you have made an error when you have not.
7 0
3 years ago
Which options are available in the Conditional Formatting dialog box? Check all that apply.
IrinaVladis [17]

Answer:

There are several options within this dialog box for applying Conditional Formatting ☼ Click the desired option under the Select a Rule Type list. ☼ The bottom portion of the dialog box will change depending on the Rule Type that was selected. ✞ Click Format Only Cells That Contain under Select a Rule Type

6 0
3 years ago
Read 2 more answers
Other questions:
  • Tomi is testing all of the links on her web page by clicking on each one in a browser. What type of testing is this considered?
    6·2 answers
  • What does "WPA" stand for?
    15·2 answers
  • Binary data is written in hexadecimal. For example, when creating a graphic for a website, colors are represented by six hexadec
    12·1 answer
  • A. True <br> b. False: variables represent storage locations in the computer's memory.
    13·1 answer
  • Select the organizational skills that can help with
    6·1 answer
  • Help! ASAP! 1 Question.........°○°​
    11·1 answer
  • Lloyd has created a validation script for a data entry form. What property should he use to test for a selected radio button?
    7·2 answers
  • The following SQL is which type of join? SELECT CUSTOMER_T. CUSTOMER_ID, ORDER_T. CUSTOMER_ID, NAME, ORDER_ID FROM CUSTOMER_T,OR
    15·1 answer
  • Assign total_owls with the sum of num_owls_A and num_owls_B.
    11·1 answer
  • What are the differences between switches and routers? cse question
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!