subject

You have been given the following String which represents a series of 6 side die rolls:rolls = "1,5,2,3,5,4,4,3,1,1,1,2,3,1,5,6,2" Write a program that analyzes the rolls and computes the following:

i. The total # of rolls.
ii. The sum of all the rolls (1+2+3…)
iii. The average value of the rolls.

Here is a sample output of your program:Total # of rolls: 17Total value of all rolls: 49Average roll: 2.88235P art 2 – Can you extend your code such that the string (for the series of die rolls) is a user input?

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 08:30, mai1261
Helen's credit card has an apr of 15.32% and a grace period of 17 days and helen pays her balance in the full every month. if her last billing cycle ended on september 26, 2009, and she made her payment on october 11, 2009, did she owe any interest on her last statement's balance?
Answers: 3
image
Computers and Technology, 23.06.2019 15:30, Dweath50
The processing of data in a computer involves the interplay between its various hardware components.
Answers: 1
image
Computers and Technology, 24.06.2019 07:00, Dkhaurithompson
Selective is defined as paying attention to messages that are consistent with one’s attitudes and beliefs and ignoring messages that are inconsistent.
Answers: 1
image
Computers and Technology, 24.06.2019 17:00, harlon852
The length of time that a slide appears before automatically advancing to the next slide can be set in the timing group under the transitions tab. transition to this slide group under the transitions tab. timing group in the master slide view. transition to this slide group in the master slide view.
Answers: 1
You know the right answer?
You have been given the following String which represents a series of 6 side die rolls:rolls = "1,5,...

Questions in other subjects:

Konu
Social Studies, 20.04.2021 00:44
Konu
Social Studies, 20.04.2021 00:44
Konu
English, 20.04.2021 00:44