geekcomputers / geekcomputers/Python
New to python had a problem
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 35.4k
- Fork
- 12.9k
- Merge trung bình
- 2 giờ 37 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với lớp Snake và traceback trong phần nội dung issue, sau đó kiểm tra Document 8.pdf được liên kết để tìm đoạn mã gốc. Tái hiện ví dụ bằng Python 3.7.2 và xác nhận rằng quá trình khởi tạo tạo ra thuộc tính được method_a sử dụng mà không phát sinh AttributeError đã được báo cáo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 25/100