Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # role playing program
- #
- # spend 30 points on strenght, health, wisdom, dexterity
- # player can spend and take points from any attribute
- # library contains attribute and points
- attributes = {"strenght": int("0"),
- "health": "0",
- "wisdom": "0",
- "dexterity": "0"}
- pool = int(30)
- choice = None
- print("The Making of a Hero !!!")
- print(attributes)
- print("\nYou have", pool, "points to spend.")
- while choice != "0":
- # list of choices
- print(
- """
- Options:
- 0 - End
- 1 - Add points to an attribute
- 2 - remove points from an attribute
- 3 - Show attributes
- """
- )
- choice = input("Choose option: ")
- if choice == "0":
- print("\nYour hero stats are:")
- print(attributes)
- print("Good-Bye.")
- elif choice == "1":
- print("\nADD POINTS TO AN ATTRIBUTE")
- print("You have", pool, "points to spend.")
- print(
- """
- Choose an attribute:
- strenght
- health
- wisdom
- dexterity
- """
- )
- at_choice = input("Your choice: ")
- if at_choice.lower() in attributes:
- points = int(input("How many points do you want to assign: "))
- if points <= pool:
- pool -= points
- result = int(attributes[at_choice]) + points
- attributes[at_choice] = result
- print("\nPoints have been added.")
- else:
- print("\nYou do not have that many points to spend")
- else:
- print("\nThat attribute does not exist.")
- elif choice == "2":
- print("\nREMOVE POINTS FROM AN ATTRIBUTE")
- print("You have", pool, "points to spend.")
- print(
- """
- Choose an attribute:
- strenght
- health
- wisdom
- dexterity
- """
- )
- at_choice = input("Your choice: ")
- if at_choice.lower() in attributes:
- points = int(input("How many points do you want to remove: "))
- if points <= int(attributes[at_choice]):
- pool += points
- result = int(attributes[at_choice]) - points
- attributes[at_choice] = result
- print("\nPoints have been removed.")
- else:
- print("\nThere are not that many points in that attribute")
- else:
- print("\nThat attribute does not exist.")
- elif choice == "3":
- print("\n", attributes)
- print("Pool: ", pool)
- else:
- print(choice, "is not a valid option.")
- input("\n\nPress the enter key to exit.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement