<div dir="ltr"><br><br>
<div class="gmail_quote">On Thu, Feb 9, 2012 at 2:43 PM, bob gailer <span dir="ltr">&lt;<a href="mailto:bgailer@gmail.com">bgailer@gmail.com</a>&gt;</span> wrote:<br>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div text="#000000" bgcolor="#FFFFFF">Always reply-all so a copy goes to the tutor list.<br><br>On 2/8/2012 11:04 PM, Michael Lewis wrote: 
<blockquote type="cite">
<div dir="ltr">Thanks Bob,</div></blockquote>Thanks for what if you did not follow my suggestions?<br></div></blockquote>
<div><font color="#3366ff">I partially followed your suggestions by getting rid of str.replace(old, new[, count]) and new_output = &#39; &#39;.join(user_input). But I also wanted to try to get this to work without simply copying your code.</font></div>


<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div text="#000000" bgcolor="#FFFFFF"><br>Your code is still pretty buggy.<br></div></blockquote>
<div>       <font color="#3366ff">I don&#39;t think I made my intentions clear. I don&#39;t wont to increment each digit. I want to find each number (for example, if the str contains 436, I don&#39;t want to interpret that as 4, 3, 6 - I instead want to interpret that as 436, which is why I created a list and then joined back into a string afterwards.</font></div>


<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div text="#000000" bgcolor="#FFFFFF"><br>Please test it by running it, seeing that the result is not correct, then try the desk checking. 
<div>
<div class="h5"><font color="#3366ff">I don&#39;t see how this is not correct, because my input was </font></div></div></div></blockquote>
<div> </div>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div text="#000000" bgcolor="#FFFFFF">
<div>
<div class="h5"><font color="#3366ff">I  got 432 when I counted, but Jim got 433 which<br>is a lot for only 6 cats, or were there 12 cats?</font></div></div></div></blockquote>
<div> </div>
<div><font style="BACKGROUND-COLOR:#ffffff" color="#3366ff">And my output was:</font></div>
<div><font color="#3366ff"></font> </div>
<div><font color="#3366ff">I  got 433 when I counted, but Jim got 434 which<br>is a lot for only 7 cats, or were there 13 cats?</font><br></div>
<blockquote style="BORDER-LEFT:#ccc 1px solid;MARGIN:0px 0px 0px 0.8ex;PADDING-LEFT:1ex" class="gmail_quote">
<div text="#000000" bgcolor="#FFFFFF">
<div>
<div class="h5">
<blockquote type="cite">
<div dir="ltr">
<div>The below code is what I came up with without using your suggestion. On a scale, how novice is mine compared to what you offered? I am curious because I want to know if I should have come up with your solution instead of what I did come up with.</div>


<div><br></div>
<div>
<div>def AlterInput(user_input):</div>
<div>    &#39;&#39;&#39;search for nums in str and increment/append, return new string&#39;&#39;&#39;</div>
<div>    new_output = []</div>
<div>    for num in user_input:</div>
<div>        if not num.isdigit():</div>
<div>            new_output.append(num)</div>
<div>        else:</div>
<div>            num.isdigit()</div>
<div>            new_num = int(num)</div>
<div>            new_num += 1</div>
<div>            new_output.append(str(new_num))           </div>
<div>    return &#39; &#39;.join(new_output)</div>
<div><br></div>
<div>def GetUserInput():</div>
<div>    &#39;&#39;&#39;Get a string from the user and pass it&#39;&#39;&#39;</div>
<div>    user_input = &#39;&#39;&#39;I * got 432 when I counted, but Jim got 433 which</div>
<div>is a lot for only 6 cats, or were there 12 cats?&#39;&#39;&#39;</div>
<div>    return AlterInput(user_input.split())</div>
<div><br></div>
<div><br></div>
<div>Your code:</div>
<div><br></div>
<div>return &#39; &#39;.join(str(int(num)+1) if num.isdigit() else num for num in user_input)</div><br></div></div></blockquote></div></div></div></blockquote></div></div>