Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
January 24th, 2005, 08:56 PM
 jarchambo
Registered User

Join Date: Jan 2005
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
Python program

I am having trouble trying to decipher how to write a program in Python. The first thing is calculating the volume and surface area of a sphere from it radius, given as input. The formulas are V=4/3pir^3 and A=4pir^2. Thanks

#2
January 24th, 2005, 09:12 PM
 codergeek42

Join Date: Jul 2003
Location: Anaheim, CA (USA)
Posts: 6,650
Time spent in forums: 1 Month 2 Weeks 6 Days 8 h 33 m 27 sec
Reputation Power: 2475
Moved from the PHP Development forum.
__________________
~~ Peter ~~ :: ( Who am I? ) :: ( Peter's Musings: Uploading myself, bit by bit... ) :: ( Electronic Frontier Foundation ) :: ( I'm a GNU/Linux addict and Free Software Advocate. ) :: ( How to Ask Questions the Smart Way ) :: ( The Fedora Project, sponsored by Red Hat ) :: ( GNOME: The Free Software Desktop Project ) :: ( GnuPG Public Key ) :: ( About me on the WIki )

#3
January 24th, 2005, 11:02 PM
 jimmy2k1
Contributing User

Join Date: Mar 2002
Posts: 89
Time spent in forums: 8 h 48 m 50 sec
Reputation Power: 12

Quote:
 Originally Posted by jarchambo I am having trouble trying to decipher how to write a program in Python. The first thing is calculating the volume and surface area of a sphere from it radius, given as input. The formulas are V=4/3pir^3 and A=4pir^2. Thanks

open a file and type:

import math

print "The volume is: ", volume
print "The area is: ", area
raw_input("Press button to continue...")

save the file with a .py extension and run it.

#4
January 25th, 2005, 01:38 AM
 SimonGreenhill
(retired)

Join Date: Dec 2003
Location: The Laboratory
Posts: 10,101
Time spent in forums: 3 Months 3 Weeks 6 h 8 m 52 sec
Reputation Power: 0
Homework?

 Viewing: Dev Shed Forums > Programming Languages > Python Programming > Python program