[Tutor] change of email
Hi, I would like to have my email changed from delegb...@dudupay.com to dipo.elegb...@dipoelegbede.com I have not in a long time used this email and as such would like all correspondences sent to the new email so that I can resume my participation in the group. I sincerely hope this would be given a top priority while I'm quite aware of your very busy schedule. I appreciate your efforts and look forward to resuming participation as soon as my email address is changed. Thank you. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] frame destroy problem
There is nothing called franeButton it should be frameButton. I guess its a typo. On 3 Nov 2011 05:52, Chris Hare ch...@labr.net wrote: I have the following code: def listUsers(self): self.frameBottom = Frame(self.base, bd=0, bg=backColor) self.frameBottom.grid(row=1, column=0,sticky=N+E+S+W) self.text = Text(self.frameBottom) self.text.grid(row=1, column=6, columnspan=5, sticky=E) self.text.insert(END, security.listUsers()) self.btnClose = Button(self.frameBottom, text=Close, command=self.closeFrameBottom,highlightbackground=backColor) self.btnClose.grid(row=2, column=4) def closeFrameBottom(self): self.franeBottom.destroy() When the listUsers method is called, everything is displayed correctly. However, when the btnClose is pressed, I get an error Exception in Tkinter callback Traceback (most recent call last): File /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py, line 1410, in __call__ return self.func(*args) File z.py, line 454, in closeFrameBottom self.franeBottom.destroy() AttributeError: Display instance has no attribute 'franeBottom' What have I got wrong? the objective is to use the bottom part opt the window over and over again. Chris Hare ch...@labr.net http://www.labr.net ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] printing a key not a value
definitions = {'name':'dipo','food':'spaghetti','age':30,'location':'lagos'} definitions.keys() ['food', 'age', 'name', 'location'] definitions.values() ['spaghetti', 30, 'dipo', 'lagos'] You can do this to get what you want. Hope it helps. On Tue, Oct 25, 2011 at 2:54 PM, bod...@googlemail.com wrote: Sure, mydict = {'a':1, 'b',2} for key in mydict: print key Hope this helps, Bodsda Sent from my BlackBerry® wireless device -Original Message- From: ADRIAN KELLY kellyadr...@hotmail.com Sender: tutor-bounces+bodsda=googlemail@python.org Date: Tue, 25 Oct 2011 13:45:50 To: tutor@python.org Subject: [Tutor] printing a key not a value ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] string immutability
What you did here is just re-assigning s. Try slicing s and then assign a new value to the slice. s[2] would return 'r' now try to to set s[2] to another value to understand immutability. Hope it helps. On 24 Oct 2011 19:06, Johan Martinez jmart...@gmail.com wrote: Hi, I am struggling to understand Python string immutability. I am able to modify Python string object after initializing/assigning it a value. So how does immutability work? I am not following it. Sorry for really stupid question. Any help? code s = First print s.__class__ type 'str' print s First s = Second print s Second /code jM. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] URLError Help.
I am trying to access a url using the urllib2.urlopen() command. It does well when i run from idle but as soon as i plug into my app; it gives me this urlopen error [Errno 10054] An existing connection was forcibly closed by the remote host. Is there anything I am doing wrong or a thing I should look at? -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] GTALK and PYTHON
Hi All, I want to write an application in python with which I can log into gtalk. Kindly point me to any documentation with which I can move on. Advices too would be of great help.. Thanks. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] CSV Ouptut concern...
i wrote a code for extracting information from a csv file into another csv file. it worked well but i have an immediate challenge i can't seem to fix. the new file that is created has an row and then an empty row and then a row all through the file. how can i make the empty rows not be part of the file. here is the code: import csv reader = csv.reader(open('stateparty.csv')) counter = 1 fh = open('stateparty2.csv','w') writer = csv.writer(fh) for row in reader: if counter == 1: parties_row = row elif counter 2: for index, column in enumerate(row[1:-1]): if column == 1: writer.writerow([row[0],parties_row[index+1]]) counter += 1 fh.close() and the output has something like this: Benue,ACN Benue,ANPP Benue,APGA Benue,CPC Benue,PDP Kogi,ACN Kogi,ADC Kogi,ANPP Kogi,APGA Kogi,CDC Kogi,CPC Kogi,DPP i am not expecting the spaces in between each line, kindly help with the challenge... thanks. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] CSV Ouptut concern...
Thanks Tim, that worked like magic. I now have another challenge on the same file, in this case, i am trying to extract just a column as PARTY, I successfully wrote the header but instead of having each element in a single excel block like this: A ACD ACN ACPN AD ADC ALP ANPP APGA APS ARP BNPP CAP CDC CPC CPN CPP DFPF DPP It is spelt out on different block like this: PARTYAA C D A C N A C P N A D A D C A L P A N P P A P G A A P S A R P B N P P C A P C D C C P C C P N C P P D F P F D P P what could be wrong with this code: import csv reader = csv.reader(open('stateparty.csv')) counter = 1 header = [PARTY] fh = open('stateparty3.csv','wb') writer = csv.writer(fh) writer.writerow(header) for row in reader: if counter == 1: parties = row[1:-1] for party in parties: writer.writerow([party]) counter += 1 fh.close() Thanks for your responses as anticipated. On Thu, Mar 17, 2011 at 1:00 PM, Tim Golden m...@timgolden.me.uk wrote: On 17/03/2011 11:56, Dipo Elegbede wrote: i wrote a code for extracting information from a csv file into another csv file. it worked well but i have an immediate challenge i can't seem to fix. the new file that is created has an row and then an empty row and then a row all through the file. how can i make the empty rows not be part of the file. Open the file in binary mode: fh = open('stateparty2.csv','wb') TJG ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] CSV Ouptut concern...
The counter is there so that it limits the iteration to only the first rows, i actually left it there because i used it earlier to print out specific rows. On Thu, Mar 17, 2011 at 2:04 PM, Joel Goldstick joel.goldst...@gmail.comwrote: On Thu, Mar 17, 2011 at 8:53 AM, Dipo Elegbede delegb...@dudupay.comwrote: Thanks Tim, that worked like magic. I now have another challenge on the same file, in this case, i am trying to extract just a column as PARTY, I successfully wrote the header but instead of having each element in a single excel block like this: A ACD ACN ACPN AD ADC ALP ANPP APGA APS ARP BNPP CAP CDC CPC CPN CPP DFPF DPP It is spelt out on different block like this: PARTYAA C D A C N A C P N A D A D C A L P A N P P A P G A A P S A R P B N P P C A P C D C C P C C P N C P P D F P F D P P what could be wrong with this code: import csv reader = csv.reader(open('stateparty.csv')) counter = 1 header = [PARTY] fh = open('stateparty3.csv','wb') writer = csv.writer(fh) writer.writerow(header) for row in reader: if counter == 1: parties = row[1:-1] for party in parties: writer.writerow([party]) counter += 1 fh.close() Thanks for your responses as anticipated. On Thu, Mar 17, 2011 at 1:00 PM, Tim Golden m...@timgolden.me.uk wrote: On 17/03/2011 11:56, Dipo Elegbede wrote: i wrote a code for extracting information from a csv file into another csv file. it worked well but i have an immediate challenge i can't seem to fix. the new file that is created has an row and then an empty row and then a row all through the file. how can i make the empty rows not be part of the file. Open the file in binary mode: fh = open('stateparty2.csv','wb') TJG ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor You want row[1] from each iteration of row. So instead of this: for row in reader: if counter == 1: parties = row[1:-1] for party in parties: writer.writerow([party]) counter += 1 fh.close() Do this: for row in reader: if counter == 1: party = row[1:2] write.writerow(party) counter += 1 What is the counter for? -- Joel Goldstick -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] help
That line only expects int and say numbers generally. If you want to print strings, use, raw_input in place of input. Try that out and then let's have a feedback. Sent from my BlackBerry wireless device from MTN On Thu, Feb 24, 2011 at 9:53 AM, Nitin Pawar nitinpawar...@gmail.comwrote: instead of input ... use raw_input() On Thu, Feb 24, 2011 at 9:45 AM, Chris Schiro cschiro...@gmail.comwrote: Hi, I am completely new to programming aside from working with basic many years ago. I purchased a Python book for beginners so I could start from scratch which has been walking me through just fine until: writing a program to interact with user for feedback: name=input(“What is your name? “) I have found that this line will return an error every time while running the completed program, unless I enter a number. If I enter a numeric value the program will continue on as written. I have followed the code exactly per the book. What is the proper coding in this scenario? Thank you, Chris ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Nitin Pawar ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfhttp://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] help
i can mail free books on python 2. if you want. starting out with python 3.XXX restricts the amount of help you can get and also free resources. most resources i have come across are python 2.XXX. cheers. On Thu, Feb 24, 2011 at 9:58 AM, Andre Engels andreeng...@gmail.com wrote: On Thu, Feb 24, 2011 at 5:15 AM, Chris Schiro cschiro...@gmail.com wrote: Hi, I am completely new to programming aside from working with basic many years ago. I purchased a Python book for beginners so I could start from scratch which has been walking me through just fine until: writing a program to interact with user for feedback: name=input(“What is your name? “) I have found that this line will return an error every time while running the completed program, unless I enter a number. If I enter a numeric value the program will continue on as written. I have followed the code exactly per the book. What is the proper coding in this scenario? What is going on is that you are presumably running some version of Python 2, whereas the book you are using is intended for Python 3. In Python 2, to get the same result as input() in Python 3, you have to use raw_input instead. name=raw_input(“What is your name? “) Alternatively, you could of course install Python 3.1 instead of Python 2.7 (or whatever version you are running). -- André Engels, andreeng...@gmail.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] SMS to URL
Hi peeps, I am trying to write a code such that i can send an sms to a specific url from my phone and get a reply back from the url. I want the reply to be the content of the url I send to; what modules would you advice. I am testing with the url: http://www.dipoelegbede.com/msg.txt. I have succeeded in writing a code that fetches the content of the page using urllib and urllib2 but i still want a way to have my sms speak to the url. I will appreciate any help in this direction. Advices or links to documentations would be fine. Thank You. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] CGI HELP
Hi all, I wrote this code as an example from a book: #!c:\Python26\python.exe # Program displaying CGI environment variables. import os import cgi def printHeader(title): print Content-type: text/html ?xml version = 1.0 encoding = UTF-8? ! DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN DTD/xhtml1-strict.dtd html xmlns = http://www.w3.org/1999/xhtml; headtitle%s/title/head body % title rowNumber = 0 backgroundColour = white printHeader(Environmental Variables) print table style = border: 0 # print table of cgi variables and values for item in os.environ.keys(): rowNumber += 1 if rowNumber % 2 == 0: # even row numbers are white backgroundColour = white else: # odd row numbers are grey backgroundColour = lightgrey print tr style = background-color: %s td%s/tdtd%s/td/tr %(backgroundColour, cgi.escape(item), cgi.escape(os.environ[item])) print /table/body/html It was supposed to return a list of environmental variables in a given order. Sadly only the header displayed. I have looked through over and over, please what am i doing wrong. This is from Deitel How to program python, Chapter 6. thanks and best regards. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] cgi help
here is the code: http://pastebin.com/K2Fxq6ac kindly help me figure out my mistake. It is supposed to return a table of environmental variables but it returns only the header and a blank page. thanks -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] python Task
Kindly help me with the following tasks. You may want to start with explanations for me and then pseudo-codes, I should be able to take it from there. They are exercises from deitel how to program for Python. I have done a lot of thinking and its almost discouraging me. Please help. Thanks. 4.4 An integer greater than 1 is said to be prime if it is divisible by only 1 and itself. For example, 2, 3, 5 and 7 are prime numbers, but 4, 6, 8 and 9 are not. a) Write a function that determines whether a number is prime. b) Use this function in a program that determines and prints all the prime numbers between 2 and 1,000. c) Initially, you might think that n/2 is the upper limit for which you must test to see whether a number is prime, but you need go only as high as the square root of n. Rewrite the program and run it both ways to show that you get the same result. 4.5 An integer number is said to be a perfect number if the sum of its factors, including 1 (but not the number itself), is equal to the number. For example, 6 is a perfect number, because 6 = 1 + 2 + 3. Write a function perfect that determines whether parameter number is a perfect number. Use this function in a program that determines and prints all the perfect numbers between 1 and 1000. Print the factors of each perfect number to confirm that the number is indeed perfect. Challenge the power of your computer by testing numbers much larger than 1000. 4.7 Write a program that plays the game of “guess the number” as follows: Your program chooses the number to be guessed by selecting an integer at random in the range 1 to 1000. The program then displays I have a number between 1 and 1000. Can you guess my number? Please type your first guess. The player then types a first guess. The program responds with one of the following: 1. Excellent! You guessed the number! Would you like to play again (y or n)? 2. Too low. Try again. 3. Too high. Try again. If the player's guess is incorrect, your program should loop until the player finally gets the number right. Your program should keep telling the player Too high or Too low to help the player “zero in” on the correct answer. After a game ends, the program should prompt the user to enter y to play again or n to exit the game. 4.8 (Towers of Hanoi) Every budding computer scientist must grapple with certain classic problems. The Towers of Hanoi (see Fig. 4.23) is one of the most famous of these. Legend has it that, in a temple in the Far East, priests are attempting to move a stack of disks from one peg to another. The initial stack had 64 disks threaded onto one peg and arranged from bottom to top by decreasing size. The priests are attempting to move the stack from this peg to a second peg, under the constraints that exactly one disk is moved at a time and that at no time may a larger disk be placed above a smaller disk. A third peg is available for holding disks temporarily. Supposedly, the world will end when the priests complete their task, so there is little incentive for us to facilitate their efforts. Let us assume that the priests are attempting to move the disks from peg 1 to peg 3. We wish to develop an algorithm that will print the precise sequence of peg-to-peg disk transfers. If we were to approach this problem with conventional methods, we would rapidly find ourselves hopelessly knotted up in managing the disks. Instead, if we attack the problem with recursion in mind, it immediately becomes tractable. Moving n disks can be viewed in terms of moving only n - 1 disks (hence, the recursion), as follows: a) Move n - 1 disks from peg 1 to peg 2, using peg 3 as a temporary holding area. b) Move the last disk (the largest) from peg 1 to peg 3. c) Move the n - 1 disks from peg 2 to peg 3, using peg 1 as a temporary holding area. The process ends when the last task involves moving n = 1 disk, i.e., the base case. This is accomplished trivially by moving the disk without the need for a temporary holding area. Write a program to solve the Towers of Hanoi problem. Use a recursive function with four parameters: a) The number of disks to be moved b) The peg on which these disks are initially threaded c) The peg to which this stack of disks is to be moved d) The peg to be used as a temporary holding area Your program should print the precise instructions it will take to move the disks from the starting peg to the destination peg. For example, to move a stack of three disks from peg 1 to peg 3, your program should print the following series of moves: 1 → 3 (This means move one disk from peg 1 to peg 3.) 1 → 2 3 → 2 1 → 3 2 → 1 2→ 3 1→ 3 -- Sent from my mobile device Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] I am looking for a book on Beginners who never programmed before or have no experience in programming
I go with Alan. If you however arrive at a choice book or books, send me a list of the books, I will check if I have any of them. I have plenty books on python now. You may not need to send a personal mail, just send it here on the forum and i would send you a download link. I hope by that everyone who wishes can have a look and I would not have violated any copyright law. Welcome to the world of python programming. You sure would get a great deal of help in here. Regards, On 9/28/10, Alan Gauld alan.ga...@btinternet.com wrote: Preetinder Singh putj...@yahoo.com wrote copying someone else. So if there any book or online tutorials for complete beginners. I went to the python website and on wiki python and there are so many books to choose from, please help me choose one. There are many because people learn in different ways. My tutor, for example, focuses on general programming principles and uses 3 languages to illustrate the points. It also assumes a fair degree of computer skills although no previous programming experience. Others take an example based approach. Others focus on a feature by feature, in depth coverage of a single language. It just depends on how you like to be taught. My advice would be to pick two or three tutorials from the Non Programmers section of the web site, follow a few of the sections in each and see which seems most effecftive to you. Stick with that tutor but when you get stuck refer to the second best to see how it covers the same topic. If you still can't understand ask questions here. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Sent from my mobile device Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Begginer Python Problems - Urgent! Due by tomorrow morning.
From what I can understand, I think you are getting what you should get. If you want the program to ask you for a number onput, i think you should type something like: x = raw_input('Enter a Number: ') x is a variable that takes whatever value you type in. This I feel should be the line if you are on python 3 and I should even ask why. I got the same advice as a beginner to learn with python 2.6 due to availability of books and tutorials. However, if it were python 2.6, type: x = input('Enter a Number: ') Here, x also takes any value you enter. Clearly, from what you have shown here, you should get something like: 24 Hello Greetings Earthing Hello Greetings Earthing Hello Greetings Earthing Hello Greetings Earthing Hello Greetings Earthing Hello Greetings Earthing Here's the explanation: The greeting functions if called should have given this: Hello Greetings Earthing Hello Greetings Earthing I iterates over the print call 2 times because you stated range(3) However, you called the greeting function in the regreet function, and stated that j should iterate in the range(4). That way, greeting is called 3 times and then you have what i have already stated above. I hope this is correct and it helps. Regards. On 9/3/10, Colleen Glaeser songbird42...@gmail.com wrote: 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 songbird42...@gmail.com 636.357.8519 -- Sent from my mobile device Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] elif statement
You need to check the indentation properly. In this case, elif has to be on the same indentation level with if. I should think so. If you're working straight from the python interactive console, like I think you're doing, you need to manually do the indentation thing by yourself. First, I don't understand why you chose to set x to 3. That is not the main thing though. After x = 3, if you press enter, you'd get the python prompt Then you type the next statement to have if x == 0: What you get after this if statement is either a whitespace or ..., from my phone, I get a ... So you manually press the spacebar twice to get an indentation for the first print statement. As soon as you press enter again, you get the dots, just type in the elif statements without pressing the spacebar. Then press enter to move to a new line where the second print statement would be,and press the spacebar twice again for indentation. For the second elif statement, follow the procedure for the first elif statement. Go ahead and press enter twice to tell the console you are done, you shouldn't get an error that way. You should get something like below: x=3 if x==0: ... print x,'is zero' ... elif x//1==1: ... print x,'is odd' ... elif x//1==0: ... print x,'is even' ... else: ... print'what is this' ... The else statement is optional. Hope it helps. On 8/11/10, Adam Bark adam.jt...@gmail.com wrote: On 11/08/10 02:34, Sudarshana Banerjee wrote: Hi: I am trying to teach myself Python, and am stuck at the indentation with the elif statement. This is what I am trying to type (as copied from the textbook): x=3 if x==0: print x is 0 elif x1 ==1: print x is a odd number elif x1==0: -- Line 6 print x is a even number If I am combining the if and the print statement, then the elif statement is in the next line, and all is well with the world. If however, I write the print as a separate statement, I am getting a syntax error after I press Enter after keying the first elif statement. x=3 if x==0: print x elif x==2: Here you have indented the elif statement but it should be at the same level as the if: x=3 if x==0: ... print x ... elif x==2: ... print something else ... SyntaxError: invalid syntax Again: x=3 if x==2: print x elif x1 == 1: print 'x is odd' elif x1 ==0: print 'x is even' SyntaxError: invalid syntax I'm not sure what's going on here but the second elif is being interpreted separate to the rest of the if statement hence a SyntaxError: elif x1 == 0: print x is even File stdin, line 1 elif x1 == 0: print x is even ^ SyntaxError: invalid syntax This works: if x==2: print x ... elif x1 == 1: print 'x is odd' ... elif x1 ==0: print 'x is even' ... x is odd If I am pressing two Enters, the code executes; so I have a elif without a if, and again, a syntax error. What am I not doing right? Thank you. Sudarshana. HTH, Adam. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] django help....
hi, I am doing reading on django what ook would you recommend for a beginner? I have been trying to work with the documentations but get stock in between and totally become lost. this continous break is giving me too much headache to move on and i am getting discouraged. Please recommend a book for starters. Thanks. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] LOCATION ISSUES
Hello All, Kindly help me with the location for the files created by this codes. I have already compiled the codes and it has no error. I copied the code from the following url: http://www.pythonware.com/library/pil/handbook/image.htm This is supposed to create thumbnails of picture in the directory where I saved my file. Please Help. Thank You. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] LOCATION ISSUES
Which is what it will do when python is started from that directory. I actually found the copies that were made by the code in the same directory but found out that they all had a .thumbnail ext which would not open and it is understandable. I have however chaged that part of the code to carry .jpg hoping to let it make thumbnails with jpg extensions. How are you starting python? I am new to python. I have basic understanding about manipulating strings, variables, lists, tuples, dictionary and all. I read along the Line as I do stuff. I am however adopting this method of taking up bigger project to make the process faster. I might be wrong though. I am expected to take up certain projects and so I hope to catch up as fast as I can. Where I run into troubles, I'd come back here truthfully. as soon as I am going commercial, I hope to also mention it here that it is commercial so if any assistance would carry financial impliccations, it could be discussed. I hope you understand it now. Thanks. Emile -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Help
I was trying to write a code that prints prime numbers between 1 and 20. I have by myself seen that something is wrong with my code and also my brain. Could anyone be kind enough to tell me what to do Where I am confused is how to test for other numbers without one and the number itself. It turns out that all numbers pass the condition I set so that would presuppose that all numbers are prime which is not. How exactly can I get it to run checks with other numbers such that it doesn't include the number itself and 1. The code is as follows: for i in range(1,20): if float(i) % 1 == 0 and float(i) % i == 0: print i, 'is a prime number' -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] module for fingerprint and pictures
Hello people, I am working on an interface that is supposed to interact with a webcam and capture pictures into a database and also fingerprint from a fingerprint hardware. Is there any python module or library I can work with. I need suggestions, assistance and information where necessary. To be truthful, I need to do a demo for that app and then go commercial if my project impresses the client. Please help me. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] what is wrong with the syntax?
Hi all, please tell me what is wrong with the syntax as written herein: http://pastebin.com/BkLi0A4H I am actually trying to let a user input something and have the input returned in a reverse form and also see the lenght of the input. please help. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] Django Read
Hi all, I have done a little basic on python and have to start working on a major django platform. I'm starting new and would like recommendations on books I can read. Kindly help me out. I want to get my hands dirty as fast as I can so that I can be part of the project. Thanks and Best regards, -- Sent from my mobile device Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] raw_input
Hello, I seem to be having problems with raw_input. i wrote something like: raw_input('Press Enter') it comes back to tell me raw_input is not defined, a NameError! Is it that something about it has changed in python 3.1 or I have been writing the wrong thing. Please enlighten me. regards. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] raw_input
Tried it out and it worked. Thanks. Regards, On 7/5/10, Shashwat Anand anand.shash...@gmail.com wrote: use input() instead of raw_input() in Python3.x On Mon, Jul 5, 2010 at 8:50 PM, Dipo Elegbede delegb...@dudupay.com wrote: Hello, I seem to be having problems with raw_input. i wrote something like: raw_input('Press Enter') it comes back to tell me raw_input is not defined, a NameError! Is it that something about it has changed in python 3.1 or I have been writing the wrong thing. Please enlighten me. regards. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Sent from my mobile device Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] PYTHON ON NOKIA E71
Hi all, Pls does anyone know whether I can install python and code on my Nokia E71? I have full access to computer at my office but not at home. This is creating a serious break in my flow of study. With python on my phone,I can learn and code on the fly. Already,I read Alan Gauld's note from my phone browser but I need to start doing stuffs with my phone. If you got an idea or the link, pls bring it on. Thanks and Best regards, -- Sent from my mobile device Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PYTHON 3.1
Sir, Under the handling files topic, trying to compile the addressbook example you gave, am I to put them all in one file and save as address book? or each is a different module is saved in different files? I have attached for your correction what I did, please let me know if it is wrong and then point out my mistakes. I'll have a look at that topic again and make sure I fix whatever correction you point out for me. Thank You. On 5/25/10, ALAN GAULD alan.ga...@btinternet.com wrote: OK, That means Python has not set up your PATH environment variable. This seems to be a common problem in recent releases, I think it is a bug but the Pyton developers disagree! :-) You need to follow the instructions in the box in the Getting Started topic. The test of whether it works is to go to the folder with your scripts in and just type python at the prompt. The usual prompt should appear. As to your attachment here are some explanations: C:\Documents and Settings\Administratorcd\C:\Python31\Project The filename, directory name, or volume label syntax is incorrect. You put the \ in front of the drive again. Also please type a space between the cd and the path, it makes it much easier to read! ie: cd C:\Python31\Project C:\Documents and Settings\Administratorcd\Python31\Project This worked because the folder is on the same drive as the prompt, ie C. C:\Python31\Projectvar.py Access is denied. This is odd. Can you try two things: 1) type dir var.* (dir for *dir*ectory listing) 2) assuming var.py is listed type attrib var.py Let me know what it says. C:\Python31\Projectpython var.py 'python' is not recognized as an internal or external command, operable program or batch file. This should have worked if the PATH environment was set up properly... C:\Python31\Projecttestingformat Access is denied. You need to specify the .py because Windows uses that to know what program to use to execute the file - if its been set up properly! C:\Python31\Projectpython testingformat 'python' is not recognized as an internal or external command, operable program or batch file. Again, even if PATH is fixed you would still neeed the .py extension C:\Python31\Projectcd\python31 C:\Python31python var.py this is a string.this string continues here. This worked so var.py is in your python31 folder Is there also a copy in the Projects folder? You should move your Projects folder somewhere else though. Because if you uninstall python 3.1 - for example when version 3.2 comes out - the uninstaller will delete python31 and everything under it - including your code! Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/ From: Dipo Elegbede delegb...@dudupay.com To: ALAN GAULD alan.ga...@btinternet.com Sent: Tuesday, 25 May, 2010 9:06:39 Subject: Re: PYTHON 3.1 got back to what you adviced Sir. I did the cd to the file where the codes were saved and typed pythonthe code but it replied python wasnot recognised. I have attached the screen of the command prompt for you to see what i mean. Thanks for your time. On 5/24/10, Dipo Elegbede delegb...@dudupay.com wrote: I'll see to that again and do exactly as you have directed. Thanks and best regards, On 5/24/10, ALAN GAULD alan.ga...@btinternet.com wrote: OK, See my other email. You should keep your code files in a completely separate folder from Python so that if you ever upgrade Python you don't lose all your code! The trick is to CD into the folder you store your code not the folder where Python lives. Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/ From: Dipo Elegbede delegb...@dudupay.com To: ALAN GAULD alan.ga...@btinternet.com Sent: Monday, 24 May, 2010 14:48:32 Subject: Re: PYTHON 3.1 Sir, I got it now. I moved all my codes to the python directory. I initially had another folder in the Python31 folder but now moved all to the Python31 folder and it's running well on the command prompt. Thanks. I'll go ahead to read stdin and stdout again and see what I can make of it. Regards, On 5/24/10, Dipo Elegbede delegb...@dudupay.com wrote: i have tried all that you advised, i still didn't run from the command prompt. Pls find attached the screen shot for various attempts I made. thanks. On 5/21/10, ALAN GAULD alan.ga...@btinternet.com wrote: I suspect the likely cause is that you need to change directory to the directory(folder) where your code lives. Lets say you keep your code in C:\Projects\Python start the DOS box Type (the bits in bold): C\:..\ cd C:\Projects\Python Now type C:\Projects\Pythonpython myprogram.py using whatever your python file is called... Now, provided everything is set up properly it should run. In fact you might even get away wioth jusdt typing: C:\Projects\Python\ myprogram.py Because in theory Windows should
Re: [Tutor] Program_to_catch_changes_in_webpage
i hope i'll one day get to this level in my programming quest. welldone all. On 5/27/10, nikunj badjatya nikunjbadja...@gmail.com wrote: Hi, Is it the standard Outlook Web Access(OWA) tool that comes with MS Exchange? Yes. Are you trying to write a script that talks to the web browser to refresh the page? Or are you looking to monitor the server? Yes, Talking to the web browser seems to be easiest way without notifying admin. Nikunj Badjatya BTech On Thu, May 27, 2010 at 1:20 PM, Alan Gauld alan.ga...@btinternet.comwrote: nikunj badjatya nikunjbadja...@gmail.com I am actually using a web interface for outlook mails. * It should periodically check for any changes in that webpage . * If their is any, then notification should be sent to user. ( some dialog pop up, or some sound. ) Is it the standard Outlook Web Access(OWA) tool that comes with MS Exchange? If so you can adjust your settings to have both an audible and visual notification of new mail. OS - Linux ( CentOS 5.4) Browser - Firefox, Opera Although that might only work on IE under Windows... I've never tried on Linux although the basic GUI works OK there. So a thought to make a script which will automatically refresh that web page, and tells to user for any new mails by popping a dialog or making a sound. Are you trying to write a script that talks to the web browser to refresh the page? Or are you looking to monitor the server? I suspect the second option is easier, but could make you unpopular with the admin team! HTH, -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PYTHON 3.1
Hello Sir, I'm trying to write a program that checks for the square root of any number input by the User. It's a fairly simple coding though atleast for an ambitious beginner. I want the code to first, calculate the square root and the tell the user whether or not. It should end up telling the User that this is a perfect square. Below is the coding: print('Check for a perfect square') number = int(input('Which number are you checking for? ')) square = (number)**(1/2.0) print('Square Root is = %.2f'%(square)) I am trying to put in something like: if square (is perfect square): print ('This is a perfect square') Pls Help. Thanks. On 5/21/10, ALAN GAULD alan.ga...@btinternet.com wrote: I suspect the likely cause is that you need to change directory to the directory(folder) where your code lives. Lets say you keep your code in C:\Projects\Python start the DOS box Type (the bits in bold): C\:..\ cd C:\Projects\Python Now type C:\Projects\Pythonpython myprogram.py using whatever your python file is called... Now, provided everything is set up properly it should run. In fact you might even get away wioth jusdt typing: C:\Projects\Python\ myprogram.py Because in theory Windows should know to run python for a .py file But it often forgets :-( Alan Gauld Author of the Learn To Program website http://www.alan-g.me.uk/ From: Dipo Elegbede delegb...@dudupay.com To: ALAN GAULD alan.ga...@btinternet.com Sent: Friday, 21 May, 2010 19:35:57 Subject: Re: PYTHON 3.1 I still can not successfully run Python from the windows command prompt after doing all you've directed in the tutorials. (Pls note, I'm not ruling out the probability that I didn't get the instructions right. As a matter of fact, this is possibly why I still have the problem.) Sir, I'm hoping you could take me through that again. Like when I type C:document and settingpython xx.py It tells me the file does not exit. It atimes starts python when I type python at the prompt to give: C:Python When i type the name of the file at the python prompt, I still get an error.e.g Pythonread.py It comes with error. It's challenging because some examples in your tutorial require I run from the prompt and so I'm getting stucked midway. Please Help. Regards, On 5/21/10, Dipo Elegbede delegb...@dudupay.com wrote: Hi Alan Sir, I have been reading through your site and the tutorials, it's just something else, I started feeling like a real programmer when i worked through the easygui thingy, it was really a mind-blower. I hope you'll pardon my pace of learning. I still didn't get some aspect under 'Conversing with the user' i really read through and I am hoping to reread but I would like you shed more light on the stdin and stdout areas. They are really confusing. Please help. Regards, On 5/20/10, Dipo Elegbede delegb...@dudupay.com wrote: Ok, Master. I should would have a lot to learn from you. I hope you'd oblige me that rare priviledge. Regards, Master! On 5/20/10, ALAN GAULD alan.ga...@btinternet.com wrote: I may consider pascal after excelling in Python. I wouldn't bother, the only place it is used nowadays is in the Borland Delphi programming tool for Windows(*). Delphi is very good if you already know Pascal but otherwise is just another language to learn! :-) (*)Although there is a freeware version of Pascal - fpc - that is compatible with Delphi if you really want to try it out. But definitely wait till after Python. (Actually Python is a good intro to Delphi, they have many features in common) Alan G. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development -- Sent from my mobile device Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PYTHON 3.1
Thanks Alan, I'm on it. Regards. On 5/18/10, Alan Gauld alan.ga...@btinternet.com wrote: Dipo Elegbede delegb...@dudupay.com wrote please confirm this is a new syntax for print. thank you. i will put up morte concerns as they arrive. Please read the Whats New in Python v3 documents first. Version 3 of Python is a major change in the language with many big changes. Do not just try stuff and send it here every time something breaks. Read the documents first so you know what to expect. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PYTHON 3.1
Hi Alan. I was looking through your page http://www.alan-g.me.uk/l2p/index.htm; Covering the topic: Looping - Or the art of repeating oneself! Under for loop, Note 3: ...*You can prove that by typing print( list( range(1,13) )*.. The print statement above seem to be incomplete, I think a single parenthesis is missing. it should be six in all. Please confirm and effect the correction on the web page. Thanks. On 5/19/10, Dipo Elegbede delegb...@dudupay.com wrote: Thanks Alan, I'm on it. Regards. On 5/18/10, Alan Gauld alan.ga...@btinternet.com wrote: Dipo Elegbede delegb...@dudupay.com wrote please confirm this is a new syntax for print. thank you. i will put up morte concerns as they arrive. Please read the Whats New in Python v3 documents first. Version 3 of Python is a major change in the language with many big changes. Do not just try stuff and send it here every time something breaks. Read the documents first so you know what to expect. -- Alan Gauld Author of the Learn to Program web site http://www.alan-g.me.uk ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] PYTHON 3.1
Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on win32 Type copyright, credits or license() for more information. print 'hello' SyntaxError: invalid syntax (pyshell#0, line 1) print ('hello') hello the above print is what i came across having installed python 3.0 and trying to run the print command. with previous versions, a print command takes the form print 'parameter' and the output is parameter but with this new version it seems you need to put in brackets like: print ('hello') to get an output like: hello please confirm this is a new syntax for print. thank you. i will put up morte concerns as they arrive. thanks. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PYTHON 3.1
thanks a lot. i was almost going to abandon this python again out of frustration. i have done it before but with you guys around, it would never happen again. i have a pdf version of python programming for absolute beginners, could anyone please help me with its accompaning CD content? thanks as i anticipate responses. regards. On Tue, May 18, 2010 at 2:02 PM, James Reynolds eire1...@gmail.com wrote: On Tue, May 18, 2010 at 8:40 AM, Dipo Elegbede delegb...@dudupay.comwrote: Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on win32 Type copyright, credits or license() for more information. print 'hello' SyntaxError: invalid syntax (pyshell#0, line 1) print ('hello') hello the above print is what i came across having installed python 3.0 and trying to run the print command. with previous versions, a print command takes the form print 'parameter' and the output is parameter but with this new version it seems you need to put in brackets like: print ('hello') to get an output like: hello please confirm this is a new syntax for print. thank you. i will put up morte concerns as they arrive. thanks. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor In python 3K print is a function. So, print('hello, world') is the correct syntax. You may find this article helpful: http://docs.python.org/py3k/whatsnew/3.0.html ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] what is wrong with this syntax?
ples help me figure out what is wrong with this syntax? print('Here are the numbers from 0 to 9') for i in the range(10): print(i) thank you. i am currently reading a byte of a python. thanks. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PYTHON 3.1
I AM CURRENTLY LEARNING WITH PYTHON 3.0 just about now, you are all blowing my minds. this is great. On Tue, May 18, 2010 at 2:49 PM, Dave Angel da...@ieee.org wrote: (Please don't top-post. Add your comments to the end of the portion you're quoting.) Dipo Elegbede wrote: thanks a lot. i was almost going to abandon this python again out of frustration. i have done it before but with you guys around, it would never happen again. i have a pdf version of python programming for absolute beginners, could anyone please help me with its accompaning CD content? thanks as i anticipate responses. regards. I don't know the version that your CD was written for. If you're going to use a tutorial, it's smart to get a matching version of Python. So if your tutorial is for 2.x, you should get Python 2.6 (or soon, 2.7). Otherwise, you'll be frequently frustrated by the differences. They're not that bad, once you know the language. But while you're learning, try to match your learning materials with your version. DaveA -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PYTHON 3.1
That's a good one Sir, i started out with 2.x series but left it for a while. Coming back now, i'm getting on well just for this few changes but I think with a forum like this, I'd fare well in this pythonic journey. Thanks. On Tue, May 18, 2010 at 2:56 PM, Walter Prins wpr...@gmail.com wrote: IMHO: If you're new to Python and just trying to learn the language, I'd suggest sticking to Python 2.x for now, as the vast majority of Python material out there still use and refer to Python 2.x syntax. IMHO it'll be a lot easier learning and coping with what's changed in Python 3 only once you are already comfortable with Python 2.x syntax, rather than trying to use materials and books referencing 2.x on 3.x and then consequently running into unexpected issues as above, and never being sure whether issues you run into is due to some mistake on your part or a difference between 2.x and 3.x. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] what is wrong with this syntax?
all worked well. thanks all. On Tue, May 18, 2010 at 2:47 PM, alex gunn alex.g...@smallshinyant.comwrote: its the the part print('Here are the numbers from 0 to 9') # for i in the range(10): #your version for i in range(10): #try this print(i) im still learning myself, so be gentle if im wrong but it worked for me. Alex -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] what is wrong with this syntax?
thanks Steven. I'll always be mindful of that. By the way, I need someone to briefly explain to me how the while loop works. a little on break will also do. thanks. On 5/18/10, Steven D'Aprano st...@pearwood.info wrote: On Tue, 18 May 2010 11:36:02 pm Dipo Elegbede wrote: ples help me figure out what is wrong with this syntax? print('Here are the numbers from 0 to 9') for i in the range(10): print(i) thank you. Others have already given you the answer, but more important is for you to learn *how* to get the answer. Look at the error message Python prints: for i in the range(10): File stdin, line 1 for i in the range(10): ^ SyntaxError: invalid syntax You get a SyntaxError, which tells you that what you've written makes no sense to the Python compiler. It also tells you that the error has nothing to do with either of the print lines. Unfortunately Python isn't smart enough to recognise that the problem is with the rather than range(10), but it points you to the correct line. -- Steven D'Aprano ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] what is wrong with this syntax?
A LITTLE EXPLANATIONS ON CONTINUE WOULD BE APPRECIATED TOO. in a recap, i would appreciate any brief explanation on 1. break 2. continue 3. while loop how they work and application in writing codes. thank you all. On 5/18/10, Dipo Elegbede delegb...@dudupay.com wrote: thanks Steven. I'll always be mindful of that. By the way, I need someone to briefly explain to me how the while loop works. a little on break will also do. thanks. On 5/18/10, Steven D'Aprano st...@pearwood.info wrote: On Tue, 18 May 2010 11:36:02 pm Dipo Elegbede wrote: ples help me figure out what is wrong with this syntax? print('Here are the numbers from 0 to 9') for i in the range(10): print(i) thank you. Others have already given you the answer, but more important is for you to learn *how* to get the answer. Look at the error message Python prints: for i in the range(10): File stdin, line 1 for i in the range(10): ^ SyntaxError: invalid syntax You get a SyntaxError, which tells you that what you've written makes no sense to the Python compiler. It also tells you that the error has nothing to do with either of the print lines. Unfortunately Python isn't smart enough to recognise that the problem is with the rather than range(10), but it points you to the correct line. -- Steven D'Aprano ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Loop basics (was Re: what is wrong with this syntax?)
thanks Steve, this response came handy. I would have to take this home and read. if i encounter difficulties, I'd get back to the house. I'm grateful. If I get more explanations though, it would be great. Regards, On 5/18/10, Steve Willoughby st...@alchemy.com wrote: I'm changing the subject line because this is going into a different topic. On Tue, May 18, 2010 at 05:39:50PM +0100, Dipo Elegbede wrote: A LITTLE EXPLANATIONS ON CONTINUE WOULD BE APPRECIATED TOO. in a recap, i would appreciate any brief explanation on 1. break 2. continue 3. while loop These are the basic constructs in many languages for repeating a set of tasks over and over, as long as some condition remains true. Say you had a function which asks the user a yes or no question and returns True if they said 'yes' or False if they said 'no'. You want to play a game as long as they keep saying they're willing to play, so assuming a function play_game() which does the actual playing, making Python keep doing this repeatedly would look like this: while ask_yes_or_no('Do you want to play a game?'): play_game() If you get into the loop and decide you want to bail out early rather than waiting for the condition to become False on its own, you can just put a break statement inside the loop. As soon as Python encounters that break, it will stop the loop. while ask_yes_or_no('Do you want to play a game?'): print 'Okay, that will be fun.' if not ask_yes_or_no('Are you sure, though?'): break play_game() continue is like break in that it upsets the normal flow of the loop body, but whereas break stops the loop completely, continue abandons only THIS run through the loop, jumps immediately back to the top, and continues from there, testing the condition to see if another trip through the loop is allowed at this point. For example, you might write the ask_yes_or_no function like this: def ask_yes_or_no(prompt): while True: answer = raw_input(prompt) if answer == 'both': print 'Now that's just silly, try again.' continue if answer == 'yes': return True if answer == 'no': return False print 'Please answer yes or no.' -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] PYTHON 3.1
ok On 5/18/10, spir ☣ denis.s...@gmail.com wrote: On Tue, 18 May 2010 14:53:45 +0100 Dipo Elegbede delegb...@dudupay.com wrote: I AM CURRENTLY LEARNING WITH PYTHON 3.0 just about now, you are all blowing my minds. this is great. Please don't write your replies on top. Write them instead just after the part(s) of the message you're replying to; and delete the rest. By doing so, you help keeping the flow of the discussion; else, everything gets messed up after 2-3 replies. Denis vit esse estrany ☣ spir.wikidot.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor