Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I took the liberty of correcting some errors/misconceptions in the code - see if this is helpful:</p> <pre><code># let's make a character selection program class Player: def __init__(self, username, age, weight, height, gender): self.username = username self.age = age self.weight = weight self.height = height self.gender = gender class Soldier(Player): def __init__(self, *args): # First of all, in order to actually inherit the attributes of "player", you need to invoke the __init__ function for "player": Player.__init__(self, *args) # The *args business is to send any arguments that can be handled by the generic player constructor to that player constructor. # You probably want to work on the instance variable "strength", so use self.strength, self.weight, and self.height self.strength = self.weight*self.height*2 # print strength print "Please enter the following" player_username = raw_input("Please enter a username: ") player_age = input("Please enter your age: ") player_weight = input("Please enter your weight: ") player_height = input("Please enter your height: ") player_gender = raw_input("Please enter your gender: ") player_character_class = raw_input("Please enter a player class: ") # I'm guessing you actually wanted to make the player a "soldier", not a generic "player" character_obj = Soldier(player_username, player_age, player_weight, player_height, player_gender) print character_obj.strength </code></pre> <p>Here is the output:</p> <pre><code>Please enter the following Please enter a username: Brionius Please enter your age: 92 Please enter your weight: 50 Please enter your height: 7 Please enter your gender: yes Please enter a player class: super soldier 700 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload