Facebook
From Scanty Hog, 3 Years ago, written in Plain Text.
This paste is a reply to Untitled from Sole Pelican - view diff
Embed
Download Paste or View Raw
Hits: 127
  1. player = {
  2.     "name": "Saul",
  3.     "health": 100,
  4.     "damage": 10
  5.     }
  6. ender_dragon = {
  7.     "health": 10,
  8.     "damage": 5,
  9.     "name": "Ender Dragon"
  10.     }
  11. villager = {
  12.     "health": 20,
  13.     "damage": 10,
  14.     "name": "Janet"
  15.     }
  16.  
  17. def fight(p1, p2):
  18.     print(f"{p1['name']} vs {p2['name']}")
  19.     p1['health'] -= p2['damage']
  20.     p2['health'] -= p1['damage']
  21.     print("After the fight, here's how they look")
  22.     print(f"{p1['health']} vs {p2['health']}")
  23.    
  24. fight(player, ender_dragon)    
  25.