Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Mark Lawrence
On 01/11/2013 02:36, bob gailer wrote: On 10/31/2013 2:51 PM, Carmen Salcedo wrote: Thanks Bob! :) I'm very new at programming in Python. I appreciate your feedback. Here are some improvements to consider: import string def main(): d = {"1" : phoneTranslator, "2" : backwardString} # map

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/31/2013 2:51 PM, Carmen Salcedo wrote: Thanks Bob! :) I'm very new at programming in Python. I appreciate your feedback. Here are some improvements to consider: import string def main(): d = {"1" : phoneTranslator, "2" : backwardString} # map user selection to corresponding functio

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
Thanks Bob! :) I'm very new at programming in Python. I appreciate your feedback. Have a great week! Sent from my iPhone On Oct 31, 2013, at 1:07 PM, "bob gailer" wrote: > On 10/31/2013 10:11 AM, Carmen Salcedo wrote: >> Thanks Bob! :) A list is great idea. I'm just trying to figure out how t

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
Hi Mark, Thanks for the feedback. I figured it out. Yes, I'm using python 2.7 (typo in the last email). Have a great day. Sent from my iPhone On Oct 31, 2013, at 10:44 AM, "Mark Lawrence" wrote: > On 31/10/2013 02:00, Carmen Salcedo wrote: >> Hi Everyone, >> >> I hope you're having a great

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
Thanks Bob! :) A list is great idea. I'm just trying to figure out how to print the number across like a phone number 555- instead of downward. I'm stuck on that. 5 5 5 Thanks again! Carmen Sent from my iPhone On Oct 31, 2013, at 9:02 AM, "bob gailer" wrote: > On 10/31/2013 7:52 AM, Car

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
Hi, I'm using python 2.7. I'm editing the program with idle. I use windows 8. I finally got the string to convert to integers, however I can't figure out how to print them in this phone number format 555-5678. The numbers are printing out this way. 5 5 5 5 6 Thank you very much. :) Carmen S

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
I'm not able to post it right now. All I did to the previous program i emailed was changed isalpha() to str.isalpha. Thanks Sent from my iPhone On Oct 31, 2013, at 7:09 AM, "bob gailer" wrote: > On 10/31/2013 6:49 AM, Carmen Salcedo wrote: >> Hi, >> >> I'm using python 2.7. I'm editing the

Re: [Tutor] Geometric sequence

2013-10-31 Thread Danny Yoo
As an aside: It shouldn't be too bad to write a "generator" for the geometric series, so that we can pick out the terms on-demand. # >>> def geometric(base): ... x = 1 ... while True: ... yield x ... x *= base ... >>> twos = geometric(2)

Re: [Tutor] Dictionary from a text file

2013-10-31 Thread Danny Yoo
> > > Note: in* 'call' : Update* ,Update it is a function defined in my python > script. My dictionary is too large so i taught rather than using directly > in python program I save it in a text file and when needed i assign it to > dictionary object . How can i assign this text file to dictionary

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/31/2013 10:11 AM, Carmen Salcedo wrote: I'm just trying to figure out how to print the number across like a phone number 555- instead of downward. I'm stuck on that. On further thought: print "%s%s%s-%s%s%s%s" % tuple(numberList) The % operator does formatting. Each %s is replaced

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/31/2013 10:11 AM, Carmen Salcedo wrote: Thanks Bob! :) A list is great idea. I'm just trying to figure out how to print the number across like a phone number 555- instead of downward. I'm stuck on that. I repeat what I said before: There are many ways to get the desired output. On

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread Mark Lawrence
On 31/10/2013 02:00, Carmen Salcedo wrote: Hi Everyone, I hope you're having a great week. I'm working on this program that converts strings to integers. Can someone please help me out? :) Below is the program: def main(): selection = input("Enter you choice. Enter 1 " +

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/31/2013 7:52 AM, Carmen Salcedo wrote: I'm not able to post it right now. All I did to the previous program i emailed was changed isalpha() to str.isalpha. That does agree with what you posted or got. The part of your original program that should print a character already is print (st

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/31/2013 6:49 AM, Carmen Salcedo wrote: Hi, I'm using python 2.7. I'm editing the program with idle. I use windows 8. I finally got the string to convert to integers, however I can't figure out how to print them in this phone number format555-5678 . The numbers are printing out this wa

Re: [Tutor] Dictionary from a text file

2013-10-31 Thread bob gailer
On 10/31/2013 2:16 AM, Nitish Kunder wrote: I have a dictionary which is in this format for ex: { '5x' : { '50' : { 'update' : { 'update-from-esxi5.0-5.0_update01' : { 'call' : Update, 'name' : 'Update50u1', 'release' : '15/03/12' }, 'update-from-esxi5.0-5.0_update02' : { 'call' : Update, 'name'

Re: [Tutor] Help with converting a string into a integer

2013-10-31 Thread bob gailer
On 10/30/2013 10:00 PM, Carmen Salcedo wrote: > Hi Everyone, hi some guidelines for this list. post in plain text not html. tell us what version of Python you are using, what OS, what you use to edit and run the program. when replying: reply-all so a copy goes to the list put yo

Re: [Tutor] Dictionary from a text file

2013-10-31 Thread Peter Otten
Nitish Kunder wrote: > I have a dictionary which is in this format > for ex: > > { > '5x' : { > '50' : { > 'update' : { > 'update-from-esxi5.0-5.0_update01' : { > 'call' : Update, > 'name' : 'Update50u1', > 'release' : '15/03/12' > }, > 'update-from-esxi5.0-5.0_update02' : { > 'call' : Update, >

[Tutor] Dictionary from a text file

2013-10-31 Thread Nitish Kunder
I have a dictionary which is in this format for ex: { '5x' : { '50' : { 'update' : { 'update-from-esxi5.0-5.0_update01' : { 'call' : Update, 'name' : 'Update50u1', 'release' : '15/03/12' }, 'update-from-esxi5.0-5.0_update02' : { 'call' : Update, 'name' : 'Update50u2', 'release' : '21/12/12' }, },

[Tutor] Help with converting a string into a integer

2013-10-31 Thread Carmen Salcedo
Hi Everyone, I hope you're having a great week. I'm working on this program that converts strings to integers. Can someone please help me out? :) Below is the program: def main():selection = input("Enter you choice. Enter 1 " + "for Phone Translator or 2 for Backward String

Re: [Tutor] Geometric sequence

2013-10-31 Thread Andreas Perstinger
On 31.10.2013 04:00, bob gailer wrote: On 10/30/2013 1:08 PM, Peter O'Doherty wrote: Hi List, I know a geometric sequence can be produced by: series = [2**x for x in range(7)] But I would like to curtail the sequence before the last element excedes a certain value. import itertools series =