Python for Dummies exaple
NewsLeecher User
newsleecher at spam.com
Wed Oct 14 05:55:45 EDT 2015
Hello,
I have the book Python for Dummies and i downloaden from the Dummiesite some
python examples.
But with this script i get an error:
But i have not so many experience to see what the error is.
Good someone help me with this ?
#Chapter 3
#Basic Elements and Syntax
#=====
#SHORT EXAMPLES
#=====
#while loop example
countdown = 10
while countdown:
print countdown,
countdown -= 1
print "blastoff!"
#
#
#try statement with input
user_input = raw_input("Enter an integer: ")
try:
number = int(user_input)
print "You entered", number
except ValueError:
print "Integers, please!"
#class example
class SayMyName:
def __init__(self, myname):
self.myname = myname
def say(self):
print "Hello, my name is", self.myname
name1 = SayMyName("Aahz")
name1.say()
#
#
--
--------------------------------- --- -- -
Posted with NewsLeecher v7.0 Beta 2
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -
More information about the Python-list
mailing list