0
why wont it print suggest something
class Word_Game: class Race: races={"Goblin","Elf","Mage","Warrior"} def getting_input(): a=Word_Game.Race.races tada=input("Enter the class you want to choose:") for i in a: if tada in a: print("You have choosen to be "+tada) return tada else: print("Pick the available characters ") getting_input() print("Inside class") def __init__(self,name): print("inside init") self.name=name about=self.name print("You have choosen to be "+getting_input()) class Goblin(Race): def goblin(self): des="A greedy creature" hp=5 mana=0 return '{0}"\n"{1}"\n"{2}'.format(des,hp,mana)
9 Answers
+ 2
Insert the code file in the reply. The above code is tough to comprehend.
+ 2
ohh godππ Not like this.. You dont know how to use SoloLearn.
+ 2
Go to SoloLearn app's home page.
choose the 4th tab
click the plus icon.
choose python
and paste your code there.
save that code and make it public.
come back to this discussion.
when you reply, you will see a ' + Insert... ' option. choose that and then your code. and then click post.
+ 2
The main reason it isnt printing anything is because you havent asked it to. Everything is inside the class definition. You havent called anything or made any object. This is just a definition of classes and their functions.
+ 1
It is tough to understand the actual identation and hence the code here.. Put your code in the code playground and save it to your profile and then add the link here using the Insert option in the reply.
+ 1
lol first time asked a question πππ
0
here's what the question is about
I created a race class and in the word game class I tried printing races tuple in the getting input method but I couldn't
0
class Word_Game:
class Race:
races={"Goblin","Elf","Mage","Warrior"}
def getting_input():
a=Word_Game.Race.races
tada=input("Enter the class you want to choose:")
for i in a:
if tada in a:
print("You have choosen to be "+tada)
return tada
else:
print("Pick the available characters ")
getting_input()
print("Inside class")
def __init__(self,name):
print("i
0
I've created object but the line you have chosen to be +getting input doesn't seem to run