geekcomputers / geekcomputers/Python
New to python had a problem
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 35.4k
- Fork
- 12.9k
- Merge medio
- 2h 37m
- PR unite (30g)
- 1
Descrizione
hello,everyone I was having time to learn python so i started learning it from day before yesterday,now I am trying to make snake game from curses module and I ran into A TROUBLE, figured someone from here would lend me some of their experience regarding this
the document is the photograph of the code fragment
Document 8.pdf
class Snake(object):
def init(self):
self.x='Hiss!'
def method_a(self,foo):
print(self.x +' '+ foo)
snake = Snake()
snake.method_a('Says the snake')
the above code fragment is having an error
upon trying to run it the terminal gives the following
Traceback (most recent call last):
File "hc.py", line 31, in
snake.method_a('Says the snake')
File "hc.py", line 28, in method_a
print(self.x +' '+ foo)
AttributeError: 'Snake' object has no attribute 'x'
can't find where the error is so i request you guys to please help me if you know any thing regarding this
and sorry i forgot the most important part of info iam using python 3.7.2 64 bit on windows 7
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con la classe Snake e il traceback nel corpo dell’issue, quindi esamina il Document 8.pdf collegato per trovare il frammento di codice originale. Riproduci l’esempio con Python 3.7.2 e conferma che l’inizializzazione crea l’attributo utilizzato da method_a senza produrre l’AttributeError segnalato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 25/100