Re: Python homework

2017-12-08 Thread ssghotra1997
import random def rollDie(num): sides = {'One':0, 'Two':0,'Three':0,'Four':0,'Five':0,'Six':0} for i in range(num): rolls = int(random.randint(1, 6)) if rolls == 1: sides['One'] += 1 if rolls == 2: sides['Two'] += 1 if rolls == 3:

Re: Round to 2 decimal places

2017-12-06 Thread ssghotra1997
On Thursday, December 7, 2017 at 12:39:38 PM UTC+11, nick martinez wrote: > On Wednesday, December 6, 2017 at 8:13:36 PM UTC-5, ssghot...@gmail.com wrote: > > The following works: > > > > import math > > > > print("This program will calculate the surface area and volume of a > > 3-dimensional co

Re: Python homework

2017-12-06 Thread ssghotra1997
On Wednesday, December 6, 2017 at 9:28:26 PM UTC+11, D'Arcy Cain wrote: > On 12/05/2017 07:33 PM, nick.martinez2--- via Python-list wrote: > > I have a question on my homework. My homework is to write a program in > > which the computer simulates the rolling of a die 50 > > times and then prints >

Re: Round to 2 decimal places

2017-12-06 Thread ssghotra1997
import math print("This program will calculate the surface area and volume of a 3-dimensional cone: ") print() print() r = input("What is the radius in feet? (no negatives): ") h = input("What is the height in feet? (no negatives): ") r = float(r) h = float(h) if r > 0 and h > 0: surfacearea

Re: Round to 2 decimal places

2017-12-06 Thread ssghotra1997
The following works: import math print("This program will calculate the surface area and volume of a 3-dimensional cone: ") print() print() r = input("What is the radius in feet? (no negatives): ") h = input("What is the height in feet? (no negatives): ") r = float(r) h = float(h) if r > 0 and h

Re: Python homework

2017-12-05 Thread ssghotra1997
import random def rollDie(num): sides = {'One':0, 'Two':0,'Three':0,'Four':0,'Five':0,'Six':0} for i in range(num): rolls = int(random.randint(1, 6)) if rolls == 1: sides['One'] += 1 if rolls == 2: sides['Two'] += 1 if rolls == 3: