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
Arpenet was the computer created by the military true or false
Sphinxa [80]

True. It was a project that the pentagon was working on in the 60's

3 0
3 years ago
What can be controlled through IoT? Choose four answers.
BaLLatris [955]

Answer:

Door locks

Light switches

Security cameras

Thermostat

Explanation:

IoT is internet of things that means network of different things that are interconnected through internet and make the decision with the help of Electronic sensors. The sensor sense the data from environment at different times and send this to the cloud (that may be the server). On the basis of this data different devices such as door looks, light switches, security cameras and thermostat take decisions with the help of controllers and change their current state.

<u>For Example</u>

In case of door look, there may be sensor that is sensing the finger prints of the user and after recognizing the person the door will be unlock. If unauthenticated user will try to open the lock a message has been sent to concerned. The training data of the the authorized persons is saved on the cloud, whenever someone tries to access, the data from sensor and cloud send to controller for making comparison and decision. So we can say that Door lock can be controlled IoT.

In case of light switches, there are few sensor available to sense the intensity of life. Different training values of that sensors are stored on the cloud. Whenever these sensors sense the light intensity, they send the data to the cloud contentiously, whenever the data match with darkness intensity, a signal has been send from controller to the switch to ON the lights.

Same as in cameras and Thermostat both are sending data to the cloud and controller. With the help of different image processing techniques and sensor camera will take the decision related to face recognition. Thermostat devices are also on and off by variation of temperature.

7 0
4 years ago
What is number system??​
lubasha [3.4K]

Answer:

It is a writing system that is, a mathematical notation for representing numbers of a given set, using digits or other symbols in a consistent manner

4 0
3 years ago
Which of the following best describes open-source web browsers?
Lostsunrise [7]
<span>Following are some best open source CRM software: Really Simple Systems
</span><span>Bitrix24 Raynet SuiteCRM vTiger 
</span>
is this what you are asking for
4 0
3 years ago
Read 2 more answers
What mode is generally used when delivering a presentation to an audience?
dybincka [34]

Answer:

delivery mode

Explanation:

there it is

7 0
3 years ago
Read 2 more answers
Other questions:
  • _ are typically comprised of a mix of _ and _
    11·2 answers
  • Write a program that opens a text le called quiz.txt for reading. This le contains a single line with a student's rst name then
    15·1 answer
  • The bus width and bus speed together determine the bus's ______ or bandwidth; that is, the amount of data that can be transferre
    5·1 answer
  • Which of the following are common navigation elements? (Choose all that apply.)
    5·1 answer
  • The owner of a candle shop has asked for your help. The shop sells three types of candles as shown below:
    9·1 answer
  • Comparing tools made of stone, iron, and bronze: place them in the correct order from least to most durable.
    5·1 answer
  • How is net pay different from gross pay?
    11·1 answer
  • When adding new hardware, such as a printer, to a computer you often have to add associated software that allows the printer to
    6·1 answer
  • Daily IT Question
    13·2 answers
  • When a file is used by a program, there are three steps that must be taken:
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!