Hi Bob- thanks for the reply again. I apologize about not &quot;replying all&quot; last time- still getting in the habit of doing this.<br><br>I am using Python version 3.1. As far as tuples are concerned, I don&#39;t NEED to use them, but I am trying to get some practice with them. This is because I am following an instructional book that is discussing nested tuples within lists. <br>
The way I get the &quot;selection&quot; variable from the user is just by typing the following: selection = input(&quot;Selection: &quot;)<br><br>I&#39;m not sure why it reads it initially as a string, but I later included the line selection = int(selection), which solved the int/str problem. <br>
<br>Also, I was about to switch to dictionaries or just lists without tuples, but another poster above stated that I could just replace the entire tuple item within the list, which technically would not be changing the tuple, so it worked out. The only problem I have now is trying to sort the 4 attributes based on their numerical value, not their alphabetical value. But when I type in  attributes.sort(reverse=True), it sorts them alphabetically because the name of the attribute is 1st in the list, and its value is 2nd. Here it is again for reference: attributes = [(&quot;strength&quot;, 0), (&quot;health  &quot;, 0), (&quot;wisdom  &quot;, 0), (&quot;dexterity&quot;, 0)]<br>
<br>Sorry if this is a bit confusing. Thanks for your help and tips so far Bob. <br><br>-Alex<br><br><div class="gmail_quote">On Wed, Aug 3, 2011 at 5:52 AM, bob gailer <span dir="ltr">&lt;<a href="mailto:bgailer@gmail.com">bgailer@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div class="im">
    On 8/2/2011 11:39 PM, Alexander Quest wrote:
    <blockquote type="cite">Hey Bob- thanks for the reply. Here is a more complete
      part of that code section (the ellipses are parts where I&#39;ve
      deleted code because I don&#39;t think it&#39;s important for this
      question):<br>
    </blockquote>
    <br></div>
    Please always reply-all so a copy goes to the list.<br>
    <br>
    Thanks for posting more code &amp; traceback<br>
    <br>
    I forgot to mention earlier - tell us which version of Python you
    are using (this looks like version 3)<br>
    <br>
    You did not answer all my questions! How come? Please do so now.<div class="im"><br>
    <blockquote type="cite"><br>
       <br>
      _____________________________________________________________<br>
      attributes = [(&quot;strength&quot;, 0), (&quot;health  &quot;, 0), (&quot;wisdom  &quot;, 0),
      (&quot;dexterity&quot;, 0)]<br>
      .....<br>
      .....<br>
      .....<br>
      print(<br>
                  &quot;&quot;&quot;<br>
                  1 - Strength<br>
                  2 - Health<br>
                  3 - Wisdom<br>
                  4 - Dexterity<br>
      <br>
                  Any other key - Quit<br>
                  &quot;&quot;&quot;<br>
                  )<br>
                  selection = input(&quot;Selection: &quot;)<br>
      if selection == &quot;1&quot; or selection == &quot;2&quot; or selection == &quot;3&quot; or
      selection == &quot;4&quot;:<br>
                      print(&quot;You have &quot;, points, &quot;points available.&quot;) <br>
                      how_many = input(&quot;How many would you like to add
      to this attribute?: &quot;)<br>
                      while how_many &lt; 0 or how_many &gt; 30 or
      how_many == &quot;&quot;:                               # Because max points
      available is 30, and entering less than 0 does not make sense. <br>
                          print(&quot;Invalid entry. You have &quot;, points,
      &quot;points available.&quot;)                               # If the user
      enters a number less than 0, greater than 30, or just presses
      enter, it loops.<br>
                          how_many = input(&quot;How many would you like to
      add to this attribute?: &quot;)<br>
                      print(&quot;Added &quot;, points, &quot;to &quot;,
      attributes[selection-1][0], &quot;attribute.&quot;)                        
      # Here is where I try to add the number of points to the value,
      based on what the user entered.<br>
                      points = points -
      how_many                                                                              
      # I subtract the number of points added from the total points
      available. <br>
                      attributes[selection-1][1] +=
      how_many                                                             
      # I add the number of points the user selected to the variable
      selected. <br>
      <br>
       <br>
__________________________________________________________________________<br>
      <br>
      <br>
      Here&#39;s the traceback I get:<br>
      <br>
      Traceback (most recent call last):<br>
        File &quot;C:\Users\Alexander\Desktop\Python Practice\Ch05-2.py&quot;,
      line 54, in &lt;module&gt;<br>
          print(&quot;Added &quot;, points, &quot;to &quot;, attributes[selection-1][0],
      &quot;attribute.&quot;)<br>
      TypeError: unsupported operand type(s) for -: &#39;str&#39; and &#39;int&#39;<br>
_________________________________________________________________________<br>
      <br>
      Thanks for any help. I understand that I can&#39;t change tuples
      directly, but is there a way to change them indirectly (like
      saying attribute.remove[x] and then saying attribute.append[x]
      with the new variable? But this seems to take out both the string
      and the value, when I only want to increase or decrease the value
      for one of the 4 strings, strength, health, wisdom, or dexterity).<br>
    </blockquote>
    <br></div>
    DON&#39;T USE TUPLES. WHY DO YOU INSIST ON THEM?<br>
    <blockquote type="cite"><br>
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
          <br>
          What does the error message( unsupported operand type(s) for
          -: &#39;str&#39; and &#39;int&#39;)  tell you? </blockquote>
      </div>
    </blockquote><div class="im">
    <br>
    <blockquote type="cite">
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Why would selection be a string rather
          than an integer? </blockquote>
      </div>
    </blockquote>
    <br>
    </div><blockquote type="cite">
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">This has to do with how you obtain
          selection from the user.<br>
          <br></div><div class="im">
          Why did you expect to be able to alter the value of a tuple
          element? Tuples are immutable! Use a list instead.<br>
          <br>
        </div></blockquote>
      </div>
    </blockquote><div class="im">
    <br>
    <pre cols="72">-- 
Bob Gailer
<a href="tel:919-636-4239" value="+19196364239" target="_blank">919-636-4239</a>
Chapel Hill NC</pre>
  </div></div>

</blockquote></div><br>