+ 2
This should fix most of your issues with the exception of maybe a game loop etc. """ First enter your STRENGTH and then your FORCE. You can have maximum of 6 strenght and force combined. """ import random enemies = {"snake": [0, 2], "bear": [0, 4], "student_loans": [0, 3], "chronic_depression": [4, 0], "apple_pie_with_legs": [3, 0], "ghost": [2, 0]} my_strength = int(input()) my_force = int(input()) my_health = 3 def random_enemy(): return random.choice(list(enemies.items())) def fight(my_health): enemy, values = random_enemy() enemy_force = values[0] enemy_strength = values[1] print("\n You found a scary " + enemy + "! It want's to fight") if enemy_force == 0: if my_strength > enemy_strength: print("\n You won!") if my_strength == enemy_strength: print("\n It's a tie.") if my_strength < enemy_strength: print("\n Oh no! It has more strength than you! You've lost 1 HP...") print(my_health) if enemy_strength == 0: if my_force > enemy_force: print("\n You won!") if my_force == enemy_force: print("\n It's a tie.") if my_force < enemy_force: print("\n Oh no! It has more force than you! You've lost 1 HP...") my_health -= 1 if my_strength + my_force > 6: print("Don't cheat in my game or i will call the cyber police!") else: fight(my_health) print("Looking around...")
11th Mar 2018, 11:46 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
You have several errors and misspellings in your code (strength), random.randint() and you're missing the parentheses () after fight and some logic issues.
11th Mar 2018, 10:58 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
I left your code very close to what you had. https://code.sololearn.com/cFZPYSiM9Ehs
12th Mar 2018, 12:00 AM
John Wells
John Wells - avatar