[Tutor] Begginer Python Problems - Urgent! Due by tomorrow morning.
Albert-Jan Roskam
fomcl at yahoo.com
Fri Sep 3 11:15:56 CEST 2010
Hi,
Just guessing:
x = 12
print (2*x)
def greetings(no):
for i in range (no+1):
print ('Hello ')
print ('Greetings, earthling')
def regreet(no):
for j in range(no+1):
greetings(no)
prompt = "Enter a number: "
no = raw_input(prompt)
regreet(no)
It's not tested because I run Python 2.7 It's generally recommended that novice
programmers run Py 2.x
Cheers!!
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public
order, irrigation, roads, a fresh water system, and public health, what have the
Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
________________________________
From: Colleen Glaeser <songbird42371 at gmail.com>
To: tutor at python.org
Sent: Fri, September 3, 2010 6:11:08 AM
Subject: [Tutor] Begginer Python Problems - Urgent! Due by tomorrow morning.
Dear Python Tutors,
I'm having trouble while typing a beginner program for python.
Due to troublesome circumstances, I had to take pictures of the assignment sheet
on my phone, and work from that.
Although it is all clearly legible, I still think something with my program is
not working.
If I run the program in the shell, I should be getting something that asks for a
number, and I need to try positive and negative numbers and see what spits out.
However, I'm getting the number 24, and a repetition of the words "Hello" and
"Greetings, earthlings."
This below is my program, and I've retyped it too many times to remember, while
looking at the assignment sheet.
What am I doing wrong? Can anybody help? D: I need to turn my results in to
class tomorrow morning!
# Lab 1
# Programmed by Colleen G.
x = 12
print (2*x)
def greetings():
for i in range (3):
print ('Hello ')
print ('Greetings, earthling')
def regreet():
for j in range(4):
greetings()
regreet()
End of program.....help needed quickly! Thank you! I am using Python 3.1.2
--
Colleen Glaeser
songbird42371 at gmail.com
636.357.8519
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100903/4c0ced8a/attachment.html>
More information about the Tutor
mailing list