[Tutor] (no subject)

Soliman, Yasmin ysoliman at uncc.edu
Sun Apr 7 01:10:29 CEST 2013


How can I fix this loop so that it multiplies the two intergers and if user types in 'quit' for either number it stops? if not it keeps going.



def multiply_integers(int1,int2):
    print int1*int2

int1=float(input('Please enter 1st integer: '))
int2=float(input('Please enter 2nd integer: '))

while True:
            multiply_integers= int("int1, int2")
            print int1*int2

            if multiply_integers == 'Quit':
                        print '\nThank you for using this program! Bye.'
                        break
            else:
                        print 'Not quitting'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130406/617b5dd9/attachment.html>


More information about the Tutor mailing list