Skip to content

Commit 0c4f186

Browse files
committed
added file item.py
1 parent ff57e60 commit 0c4f186

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

‎src/item.py‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class Item (object):
2+
def __init__(self, name, description):
3+
"""
4+
Initializing the items name and description for the Item class.
5+
"""
6+
self.name = name
7+
self.description = description
8+
self.light = False
9+
def __repr__(self):
10+
"""
11+
returns a string describing the name and description of the item class
12+
"""
13+
return f"The item name is {self.name}. Description : {self.description}."
14+
def on_take(self):
15+
"""
16+
returns a string upon the user taking a item.
17+
"""
18+
return "This item maybe useful.."
19+
def on_drop(self):
20+
"""
21+
returns a string upon the user dropping an item.
22+
"""
23+
return "No use for this item right now but remember where you dropped it. Might come in handy later.."

0 commit comments

Comments
 (0)