Re: Round to 2 decimal places

2017-12-06 Thread Steve D'Aprano
On Thu, 7 Dec 2017 01:31 pm, nick martinez wrote: > interesting, what version of python are you using? Tried it multiple times > and it still isn't working. Please launch a terminal window, copy this command exactly into the terminal and hit ENTER. You should have a $ or maybe % prompt for this

Re: Round to 2 decimal places

2017-12-06 Thread Steve D'Aprano
u show exactly what values you have tried. This works for me: py> volume = 1.23456789 py> print(volume ) 1.23456789 py> print(round(volume , 2)) 1.23 The rest of your code is interesting but irrelevant to your question. If you want to learn how to round to 2 decimal places, the actual cal

Re: Round to 2 decimal places

2017-12-06 Thread nick martinez via Python-list
On Wednesday, December 6, 2017 at 9:32:27 PM UTC-5, nick martinez wrote: > On Wednesday, December 6, 2017 at 9:03:27 PM UTC-5, ssghot...@gmail.com wrote: > > 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...

Re: Round to 2 decimal places

2017-12-06 Thread nick martinez via Python-list
On Wednesday, December 6, 2017 at 9:03:27 PM UTC-5, ssghot...@gmail.com wrote: > 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 > >

Re: Round to 2 decimal places

2017-12-06 Thread MRAB
On 2017-12-07 01:39, nick martinez via Python-list 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 cone: ") print() print() r = input("What

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: Round to 2 decimal places

2017-12-06 Thread nick martinez via Python-list
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 cone: ") > print() > print() > r = input("What is the radius in feet? (no negatives): ") >

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

Round to 2 decimal places

2017-12-06 Thread nick martinez via Python-list
I'm stuck. I need my program to round the end solution to 2 decimal places but cant figure it out. Can someone help? I've been trying between printf and round() but cant seem to get either to work. Python 3.5 is what I'm using. import math print("This program will calculate the surface area and