Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enemies = 1
- def increase_enemies():
- enemies = 2
- print(f"enemies inside function: {enemies}")
- increase_enemies()
- print(f"enemies outside function: {enemies}")
- #local scope
- # def drink_potion():
- # potion_strength = 2
- # print(potion_strength)
- #drink_potion()
- #global scope
- player_health = 10
- def drink_potion():
- potion_strength = 2
- print(potion_strength)
- print(player_health)
- drink_potion()
- print(player_health)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement