from sys import exit def welcome(): hi = (""" "Welcome to the first rpg game!" Before we start I need you to use your 0 - quit 1 - Strength 2 - HP 3 - Wisdom 4 - Agility """) print(hi) def remaining_points_screen(): rem_points = total print('you have', rem_points, 'points left\n') def return_screen(): back = input("""To return to the selection screen type return\n to quit press 0\n""") while True: if back == "0": print('chop-chop') exit() elif back == "return": welcome() remaining_points_screen() break def points_conditions(): if add > 30: print('Pardon my friend, but grow a beard, go to the forest and earn these points') elif add == 30: sure = input("Are you sure that you want to use all your points for this attribute?\n") if sure == "yes": print('You have:', total,'points left') return_screen() elif sure == "no": return_screen() elif add > points: print('I am sorry but you do not have that many points left') return_screen() welcome() while True: points = 30 strength = 0 hp = 0 wisdom = 0 agility = 0 choice = input('choose:\n') if choice == "0": exit() if choice == "1": add = int(input("How many Strength points do you want to add?\n")) total = points - int(add) strength =+ add points =- add print('you have', strength,'strength points\n') print('you have', total,'points left') return_screen() elif choice == "2": add = int(input("How many HP points do you want to add?\n")) total = points - int(add) points =- add HP =+ add print('you have', HP,'HP points') print('you have', total,'points left') return_screen() else: print('chop-chop') exit()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question