python - I am getting an EOF error and don't know how to fix it -
i trying write program fits these rules:
lease , it’s time move. unfortunately, have lot of stuff , don’t want spend time moving because you’d rather practicing programming skills. thankfully, have friends can help, though comes @ cost. friends can move 20 boxes hour, require 1 16 inch (diameter) pizza work. write function in python takes number of boxes have , returns how square feet of pizza have buy. use function header: sqftpizza(numboxes)
and have return square feet of pizza float.
this code have
def sqftpizza(numboxes): = 3.14159*(8*8) c = 1/12**2 sqft = * c za =numboxes/20 area = za * sqft print (area) def question(): numboxes= float(int(input("how many boxes have?: " ))) sqftpizza(numboxes) question()
please help?
making function name pep8-compliant,
# --- python 2.x --- __future__ import division # make int/int return float math import pi pizza_per_box = pi * (8 / 12)**2 / 20 # 1 16" pizza per 20 boxes def sq_ft_pizza(num_boxes): """ input: number of boxes moved output: square feet of pizza feed movers """ return pizza_per_box * num_boxes def main(): num_boxes = float(raw_input("how many boxes must move? ")) print("you need {:0.2f} square feet of pizza!".format(sq_ft_pizza(num_boxes))) if __name__ == "__main__": main()
which runs like
how many boxes must move? 120 need 8.38 square feet of pizza!
Comments
Post a Comment