[Tutor] Translate word to number

2013-10-24 Thread ivantham@raspberrypi
Hi, I'm new to programming. I'm using python 3 and Debian Linux. My name is Ivan. I'm bad in for loops, I can't complete the following code: input_word = input(Word to translate -- ) How to change this to for loops? a, b, c, d, e, f, g, h = 1, 2, 3, 4, 5, 6, 7, 8

[Tutor] Count Help

2013-10-24 Thread Jackie Canales
let say i have a file with random letters of  A, AB, C, CD, AC, A, D, CD, DD, C, B, AB, CD, AB How do i count the occurrence of each individual item. def occurence(name):     infile = open('bloodtype1.txt', 'r')     lst = infile.read()     infile.close()     print(lst.count('AB')) # 3    

Re: [Tutor] export postgresql to unified, templated xml

2013-10-24 Thread Konrad Korżel
Using PostgreSQL XML functions will be more efficient here, check http://stackoverflow.com/questions/4967117/create-xml-from-postgresql/10399117#10399117for examples. You can try to do this in Python (by creating SQL selects for every table and then parsing each return row into XML), but for it

[Tutor] Argparse and how best to use it

2013-10-24 Thread Paradox
I am trying to learn about argparse and how best to incorporate it into my scripts. I am using Python 2.7.5 on Ubuntu 13.10. It seems from the argparse tutorial that all the arguments are processed as global variables. Is that the standard way to do it or do you normally (when doing real

Re: [Tutor] Count Help

2013-10-24 Thread Dave Angel
On 23/10/2013 22:12, Jackie Canales wrote: let say i have a file with random letters of  A, AB, C, CD, AC, A, D, CD, DD, C, B, AB, CD, AB How do i count the occurrence of each individual item. def occurence(name):     infile = open('bloodtype1.txt', 'r')     lst = infile.read() read()

[Tutor] Python and memory allocation

2013-10-24 Thread #PATHANGI JANARDHANAN JATINSHRAVAN#
Hello All, Before starting to learn python, I first learnt C and C++ for a couple of years. In C/C++, the choice to assign memory during compile time or during execution time, i.e. assigning memory from the stack or the heap lay with the programmer right? But in Python, I have only seen

Re: [Tutor] Translate word to number

2013-10-24 Thread Dave Angel
On 24/10/2013 06:57, ivantham@raspberrypi wrote: Hi, I'm new to programming. I'm using python 3 and Debian Linux. My name is Ivan. I'm bad in for loops, I can't complete the following code: Welcome to Python, and to the tutor newsgroup. This is the right place to ask this sort of question.

Re: [Tutor] Argparse and how best to use it

2013-10-24 Thread Dave Angel
On 24/10/2013 11:38, Paradox wrote: I am trying to learn about argparse and how best to incorporate it into my scripts. I am using Python 2.7.5 on Ubuntu 13.10. Welcome to python, and to python-tutor mailing list. And thanks for using text mode email, and for supplying both your Python

Re: [Tutor] Python and memory allocation

2013-10-24 Thread Joel Goldstick
On Thu, Oct 24, 2013 at 12:38 PM, #PATHANGI JANARDHANAN JATINSHRAVAN# jatinshr...@e.ntu.edu.sg wrote: Hello All, Before starting to learn python, I first learnt C and C++ for a couple of years. In C/C++, the choice to assign memory during compile time or during execution time, i.e.

Re: [Tutor] Argparse and how best to use it

2013-10-24 Thread Mark Lawrence
On 24/10/2013 16:38, Paradox wrote: I am trying to learn about argparse and how best to incorporate it into my scripts. I am using Python 2.7.5 on Ubuntu 13.10. It seems from the argparse tutorial that all the arguments are processed as global variables. Is that the standard way to do it or

[Tutor] checking list position

2013-10-24 Thread Mauricio Villamil
Hello, And thank you for any help. I am writing a little prog. On this part I need to recursively (preferably) write to a list a value only if it's less than 49, else do an operation to make it less than 49, then check which is the next available spot on the list and write there ... so pseudo

Re: [Tutor] Want to keep to two decimal places for currency

2013-10-24 Thread Shelby Martin
Thank you for your replies. I suspect the solution is a bit more advanced than where I'm at now, which is chapter 2 of a beginner's book. Not sure why the author chose to use examples using money calculations when other calculations that don't need rounding would have sufficed. I will have to

Re: [Tutor] Python and memory allocation

2013-10-24 Thread Dave Angel
On 24/10/2013 12:38, #PATHANGI JANARDHANAN JATINSHRAVAN# wrote: Hello All, Before starting to learn python, I first learnt C and C++ for a couple of years. In C/C++, the choice to assign memory during compile time or during execution time, i.e. assigning memory from the stack or the

Re: [Tutor] Python and memory allocation

2013-10-24 Thread Alan Gauld
On 24/10/13 17:38, #PATHANGI JANARDHANAN JATINSHRAVAN# wrote: on. So, is there a concept of heap and stack in python or is it abstracted? Joel and Dave have given you the answers to this bit And does python being an interpreted language have to do anything with this? Nothing at all.

Re: [Tutor] Python and memory allocation

2013-10-24 Thread Danny Yoo
And does python being an interpreted language have to do anything with this? I have to interrupt: you mean to say: And does the C implementation of Python (CPython) have to do anything with this?. There are several implementations of Python out there. Not all of them use an interpreter in the

Re: [Tutor] Want to keep to two decimal places for currency

2013-10-24 Thread Danny Yoo
On Thu, Oct 24, 2013 at 9:37 AM, Shelby Martin shelby.mar...@gmail.comwrote: Thank you for your replies. I suspect the solution is a bit more advanced than where I'm at now, which is chapter 2 of a beginner's book. Probably because talking about the gory details would completely derail the

Re: [Tutor] Want to keep to two decimal places for currency

2013-10-24 Thread bob gailer
On 10/24/2013 2:09 PM, Danny Yoo wrote: Related: I saw a picture the other day on Google+ of an mailing envelope whose zip code was written in scientific notation. That;s odd - since ZIP codes are character, not integer, -- Bob Gailer 919-636-4239 Chapel Hill NC

Re: [Tutor] Argparse and how best to use it :p:

2013-10-24 Thread Paradox
On 10/24/2013 12:50 PM, Dave Angel wrote: Not sure which tutorial you're using, but the refernce page: http://docs.python.org/3.3/library/argparse.html Actually I am using 2.7.5, the tutorial found here: http://docs.python.org/2/howto/argparse.html#id1 but the problem is the same.

[Tutor] Python 3.3 on OpenSUSE 12.3

2013-10-24 Thread Rafael Knuth
Hej, I can't get Python 3.3 up and running (it's properly installed but I can't launch it), and I was wondering if anyone using OpenSUSE 12.3 had similar issues. SUSE community folks weren't really able to help me, so I was wondering I give it a try here. Thanks, Rafael

Re: [Tutor] Want to keep to two decimal places for currency

2013-10-24 Thread Jerry Hill
On Thu, Oct 24, 2013 at 2:25 PM, bob gailer bgai...@gmail.com wrote: That;s odd - since ZIP codes are character, not integer, It's not that odd. US Zip codes are a sequence of digits. I've worked with plenty of databases where ZIP codes are held in Numeric columns. It's not the ideal format

Re: [Tutor] Want to keep to two decimal places for currency

2013-10-24 Thread Marc Tompkins
On Thu, Oct 24, 2013 at 11:25 AM, bob gailer bgai...@gmail.com wrote: On 10/24/2013 2:09 PM, Danny Yoo wrote: Related: I saw a picture the other day on Google+ of an mailing envelope whose zip code was written in scientific notation. That;s odd - since ZIP codes are character, not integer,

Re: [Tutor] Want to keep to two decimal places for currency

2013-10-24 Thread Marc Tompkins
On Thu, Oct 24, 2013 at 1:21 PM, Marc Tompkins marc.tompk...@gmail.comwrote: On Thu, Oct 24, 2013 at 11:25 AM, bob gailer bgai...@gmail.com wrote: On 10/24/2013 2:09 PM, Danny Yoo wrote: Related: I saw a picture the other day on Google+ of an mailing envelope whose zip code was written in

[Tutor] python, xml, mongodb

2013-10-24 Thread Ismar Sehic
hello, me again - the guy with a (mis)fortune of having to deal with a lot of company's in and outgoing xml.I guess they just like xml as a data interchange format, its human readable.i've done my task of exporting the entire postgresql database to some prestructured xml, and i guess i've done the

Re: [Tutor] Python 3.3 on OpenSUSE 12.3

2013-10-24 Thread Jay Lozier
On Thu, 2013-10-24 at 21:57 +0200, Rafael Knuth wrote: Hej, I can't get Python 3.3 up and running (it's properly installed but I can't launch it), and I was wondering if anyone using OpenSUSE 12.3 had similar issues. SUSE community folks weren't really able to help me, so I was wondering I

Re: [Tutor] Argparse and how best to use it

2013-10-24 Thread Alex Kleider
On 2013-10-24 08:38, Paradox wrote: I am trying to learn about argparse and how best to incorporate it into my scripts. I am using Python 2.7.5 on Ubuntu 13.10. It seems from the argparse tutorial that all the arguments are processed as global variables. Is that the standard way to do it or

Re: [Tutor] Argparse and how best to use it

2013-10-24 Thread Mark Lawrence
On 24/10/2013 23:45, Alex Kleider wrote: On 2013-10-24 08:38, Paradox wrote: I am trying to learn about argparse and how best to incorporate it into my scripts. I am using Python 2.7.5 on Ubuntu 13.10. It seems from the argparse tutorial that all the arguments are processed as global

Re: [Tutor] checking list position

2013-10-24 Thread Dave Angel
On 23/10/2013 21:42, Mauricio Villamil wrote: Hello, And thank you for any help. Welcome to the python-tutor mailinglist. Please use text emalis, not html. Your email program has lost all the indentation below, making your program really hard to follow. I am writing a little prog. On

Re: [Tutor] Argparse and how best to use it :p:

2013-10-24 Thread Dave Angel
On 24/10/2013 14:23, Paradox wrote: On 10/24/2013 12:50 PM, Dave Angel wrote: Not sure which tutorial you're using, but the refernce page: http://docs.python.org/3.3/library/argparse.html Actually I am using 2.7.5, the tutorial found here: