Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 27th, 2007, 1:18 AM   #1
blake_jl
Newbie
 
Join Date: Nov 2007
Posts: 14
Rep Power: 0 blake_jl is on a distinguished road
Question Number 2 - printTwice

I'm back with another simple question.

I won't dwell over this like I did the last one. I'd just like to know why the author of the book I've been reading says

printTwice(5)

Gives the result

5 5

He has a few different examples all to do with the printTwice call but when I try and do it, it says

Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
NameError: name 'printTwice' is not defined

Thanks.
blake_jl is offline   Reply With Quote
Old Nov 27th, 2007, 4:38 AM   #2
ZenMasterJG
Hobbyist Programmer
 
ZenMasterJG's Avatar
 
Join Date: Nov 2004
Location: Boston, MA
Posts: 148
Rep Power: 4 ZenMasterJG is on a distinguished road
Send a message via AIM to ZenMasterJG
Re: Question Number 2 - printTwice

Because, presumably, you haven't defined printTwice in that script / interactive session. My guess is you're reading a bit too fast and missed something like:

def printTwice(arg):
    print arg
    print arg
ZenMasterJG is offline   Reply With Quote
Old Nov 27th, 2007, 4:44 AM   #3
blake_jl
Newbie
 
Join Date: Nov 2007
Posts: 14
Rep Power: 0 blake_jl is on a distinguished road
Re: Question Number 2 - printTwice

Quote:
Originally Posted by ZenMasterJG View Post
Because, presumably, you haven't defined printTwice in that script / interactive session. My guess is you're reading a bit too fast and missed something like:

def printTwice(arg):
    print arg
    print arg
Yes you are correct.

Thanks for that. Not sure how I missed it but I thought it was like "print" but just printed it twice instead of once.

Thanks again.
blake_jl is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question Number 1 blake_jl Python 11 Nov 24th, 2007 7:47 PM
c-unix-childprocesses-random number programmingnoob C 7 Feb 6th, 2007 8:39 PM
very simple question. make button change number in edit box nickm Delphi 2 Apr 29th, 2006 10:47 PM
One more question infinite! massive-war C++ 8 Apr 11th, 2005 12:11 AM
Number Systems... Ade Coder's Corner Lounge 7 Jan 19th, 2005 5:32 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:32 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC