189k views
2 votes
Write a function that checks whether your game character has picked up all the

items needed to perform certain tasks and checks against any status debuffs. Confirm checks with print statements.
Game Character has the following item list: [pan, paper, idea, rope, groceries]
Game Character has the following status debuffs: [slow]
Task 1: Climb a mountain – needs rope, coat, and first aid kit, cannot have slow
Task 2: Cook a meal – needs pan, groceries, cannot have small
Task 3: Write a book – needs pen, paper, idea, cannot have confusion

use python and explain the code

User Kozue
by
4.8k points

1 Answer

4 votes

You can use this as a starter code:

def __init__(self, nickname, weapons, weaknesses):

self.nickname = nickname

self.weapons = weapons

self.weaknesses = weaknesses

def get_model(self):

return self.nickname

def get_year(self):

return self.weapons

def get_color(self):

return self. weaknesses

def profile(self):

return self.nickname, self.weapons, self. weaknesses

player1 = character('','','')

player1.nickname = 'Dragon Slayer'

player1.weapons = ['pan', 'paper', 'idea', 'rope', 'groceries']

player1.weaknesses = ['slow']

for item in player1.weapons:

print("Item: ", item)

for debuff in player1.weaknesses:

print("Debuff: ", debuff)

User GordonShumway
by
4.8k points