If you copy someone else's code, you should make sure you copy it correctly. Also, you should make sure that you have the right to use their code...
Fixing it is as simple as running (includes compiling) it and fixing where the compiler says something went wrong.
This should be (more or less) all right now:
import time
import random
print("Welcome to the jungle, a place where magical creatures abound.")
time.sleep(2)
print("These creatures are not friendly, and to make it out of the jungle alive.")
time.sleep(2)
print("Good luck!")
time.sleep(2)
health = 20
print("You first encounter a giant three-horned beetle! It is black, slimy, and angry.")
time.sleep(2)
print("The beetle starts charging toward you!")
choice = input("Would you like to fight or run?")
if choice == "fight":
weapon = input("Your options are to set a trap, use your bare hands, or use a stick.")
if weapon == "set a trap":
print("You have captured the beetle!")
health = health + 50
if weapon == "use bare hands":
print("You have lost to the beetle. Game over.")
exit()
if weapon == "use a stick":
print("You have killed the beetle!")
health = health + 50
else:
print("You have outrun the beetle and are safe!")
health = health + 30
print("You have",health,"health points.")
time.sleep(2)
print("Uh-oh! A huge dinosaur with purple wings is flying right towards you! It has sharp, pointy teeth and looks hungry!")
time.sleep(2)
print("You can redeem your health points for a sword or a pair of wings.")
time.sleep(2)
option = input("Would you like a sword or wings?")
if option == "wings":
health = health - 20
print("You can fly!")
time.sleep(1)
print("You now have", health, "health points.")
time.sleep(2)
print("The dinosaur is flying after you!")
time.sleep(2)
print("The dinosaur has overtaken you. Game over.")
exit()
if option == "sword":
health = health - 20
print("You now have a sword!")
time.sleep(1)
print("You now have", health, "health points.")
time.sleep(2)
print("Get ready for the fight!")
time.sleep(2)
strikes = random.randint(3, 6)
for i in range(strikes):
print("The dinosaur strikes you!")
health = health - 10
time.sleep(1)
print("You now have", health, "health points.")
time.sleep(2)
if health == 0:
print("You have been mortally wounded. Game over.")
exit()
print("You strike the dinosaur!")
time.sleep(2)
print("Finally, the fight is over, and you have survived the attack!")
time.sleep(2)