Thursday, October 4, 2018

Math python

CountChange.py

#program counts change
#int, float
import math

def main():
    print("Change Counter")
    print()
    print("please enter the count of coin type ")
    quarters = int(input ("Quarters: "))
    dimes=int(input("Dimes: ") )
    nickles=int(input("Nickles: "))
    pennies=int(input("Pennies: "))
    total = quarters * .25 + dimes * .10 + nickles * .05 + pennies * .01
    print()
    print("The total value is:  ", round(total,2))

main()

Here are are math excercises

import math

root = math.sqrt(144)
print(root)

#Integer Division
quotient = 12 // 7
remainder = 12 % 7
print("the quotient is ", quotient, "the remainder is ", remainder)
#float division
result = 12 / 7
print (result)
cube = 4 ** 3
print (cube)

No comments:

Post a Comment