geekcomputers / geekcomputers/Python
New to python had a problem
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 35.4k
- Forks
- 12.9k
- Merge medio
- 2 h 37 min
- PR fusionados (30 d)
- 1
Descripción
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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con la clase Snake y el traceback del cuerpo del issue y, a continuación, inspecciona el Document 8.pdf enlazado para encontrar el fragmento de código original. Reproduce el ejemplo con Python 3.7.2 y confirma que la inicialización crea el atributo utilizado por method_a sin producir el AttributeError indicado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- backend
- Tipo de issue
- Error
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 25/100