Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bad input
#1
def __init__(self, name, gender, hp,attack, mp,exp,level): 
      '''Use double underscores'''
      #This method initializes the attibutes of the Character class
      self.name = name
      self.gender = gender
      self.hp = hp
      self.attack = attack
      self.mp = mp
      self.exp = exp
      self.level = level
      #these are the Character's stats.
    def __str__(self):
      return(str(self.name)+":  level "+str(self.level)++str(self.hp)+" hp, ")
      '''To be used in battle'''
    def level_check(self):
      if self.level==0:
        level_exp=50
      if self.exp>=level_exp:
        self.level=self.level+1
        level.exp=level.exp*3
        stat_points=5
        while stat_points>0:
          #put something here later
  chara1=Chara(input("What is your name?"),input("Are you a boy or a girl? \n\t 1. Boy \n\t  2. Girl"),9,3,0,0,0)
This is my code. On the last line, there is a "SyntaxError: bad input on line 53 in main.py." I've looked through it and found that the problem has to do with my use of the inputs. I can't find what's wrong please help.
Reply
#2
Don't post multiple threads, and use proper code tags please.
Can you show the line 53 of your code?
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply
#3
(May-14-2020, 10:12 AM)pyzyx3qwerty Wrote: Can you show the line 53 of your code?

This is it:
chara1=Chara(input("What is your name?"),input("Are you a boy or a girl? \n\t 1. Boy \n\t 2. Girl"),9,3,0,0,0)

Also, I did not think that I posted it twice.
Reply
#4
The error is on line 52 where you don't have anything inside the while statement. Just add a "pass" command to stub out the code for later
            while stat_points>0:
                pass
Reply
#5
(May-14-2020, 03:59 PM)Impropabletank Wrote: Also, I did not think that I posted it twice.
https://python-forum.io/Thread-Bad-input
pyzyx3qwerty
"The greatest glory in living lies not in never falling, but in rising every time we fall." - Nelson Mandela
Need help on the forum? Visit help @ python forum
For learning more and more about python, visit Python docs
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020