CIS 122 LECTURE Debugging

Floatinputmsg while number 0 product product

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: loat(input(msg)) print("Product is ", product) #any number you type in will give you zero, because zero times any number is zero #to fix it, use product = 1 instead of product = 0 fixed code: product = 1 msg = "Type a positive number, or zero to quit " number = float(input(msg)) while number > 0: product = product * number print("Product", product, "Number", number) number = float(input(msg)) print...
View Full Document

This note was uploaded on 02/19/2013 for the course CIS 122 taught by Professor Staff during the Winter '08 term at Oregon.

Ask a homework question - tutors are online