[Tutor] Changing only intergers in a list of strings
Colin Struthers
303cookiemonster at gmail.com
Tue Feb 4 23:05:21 CET 2014
I am in a beginning python course and am working through some code and I
can't even figure out how to start building this particular section of code.
My goal is to get a sentence for the user and to take each number in the
user string and add 1 to each number. i.e "the 4 people had 6 dogs" would
change to "the 5 people had 7 dogs"
*a_string = [ ]int_list = [ ]a_string = raw_input("Enter a sentence with
both words and numbers: ")def FindNumbers(): print "You entered: ",
a_string for ints in a_string ...?FindNumbers()*
I fully understand that this doesn't even begin to work but I don't really
know where to start deconstructing the list, editing only the intergers,
and joining it all back together.
Thanks for the help.
--
Colin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140204/f41e8b64/attachment-0001.html>
More information about the Tutor
mailing list