Python Program Using Math Module and Pi

by matt392 in Circuits > Software

24 Views, 0 Favorites, 0 Comments

Python Program Using Math Module and Pi

pi-image.jpg
python-logo-master.png

Short Python program that utilizes Pi from Python's math module.

# Define function to multiply pi

def pimultiply(numberoftimestomultiply):
biggerpi = math.pi * numberoftimestomultiply
print(math.pi, "times", numberoftimestomultiply, "equals", biggerpi)

# Bring the math module into the program
import math

# Call function
pimultiply(2)
pimultiply(3)
pimultiply(4)
pimultiply(5)
pimultiply(6)

Downloads