This link is better: https://docs.python.org/2/tutorial/errors.html
On Tue, Mar 17, 2015 at 1:09 AM, Dorian Hoxha <[email protected]> wrote: > Hi Marc. Try this: > > while True: > try: > x = int(raw_input("give a number:") > break > except (ValueError, KeyError): > print "x must be a number, while you entered %s" % x > math.sqrt root = (x) > print x > > See docs to learn more: https://docs.python.org/2/library/exceptions.html > (python2.7) > > > > 2015-03-17 0:32 GMT+01:00 Marc Stevens <[email protected]>: > >> Hoe onderschep ik een error melding als bij de invoer van een getal als >> een letter word ingegeven? >> Bijv: >> >> >> import math >> >> x=int(raw_input(“geef een getal in”)) >> wortel=math.sqrt(x) >> print x >> >> _______________________________________________ >> Python-nl mailing list >> [email protected] >> https://mail.python.org/mailman/listinfo/python-nl >> >> >
_______________________________________________ Python-nl mailing list [email protected] https://mail.python.org/mailman/listinfo/python-nl
