cis122.spr13.wk3d1.post

5 rsquared radius 2 pizzaarea pi rsquared

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: pi * r_sq return area def pizza_calc(cost, size): # given the cost and the size (diameter) of a pizza, # return the cost per square inch pi = 3.14159 radius = (size * .5) r_squared = radius ** 2 pizza_area = pi * r_squared comparison_cost = cost / pizza_area return comparison_cost pizza_area = area(size) comparison_cost = cost / pizza_area return comparison_cost CIS 122 Introduc2on to Programming Spring 2013 CIS 122 Introduc2on to Programming Spring 2013 def double(x): # return twice x return x * 2 >>> x = 1 >>> x = double(x + 1) + double(x + 2) >>> x def double(a): # return twice a return a * 2 >>> x = 1 >>> x = double(x + 1) + double(x + 2) >>> x 1 4/16/13 CIS 122 Introduc2on to Programming Spring 2013 def double(a): # return twice a return a * 2...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online