Skip to content

Commit

Permalink
Improved the menu options (again) pt.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ldeloijer-D committed Nov 25, 2022
1 parent a608e1e commit cc2add6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion PythonTrainingGroupB/Portfolios.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"users": {"louk123": {"portfolio": {"balance": 500, "stocks": {"AAPL": {"quantity": 5, "price": 151.14}, "IBM": {"quantity": 1, "price": 1501.14}}}}, "luuk": {"portfolio": {"balance": 16060, "stocks": {"AAPL": {"quantity": 5, "price": 151.14}, "IBM": {"quantity": 1, "price": 1501.14}}}}, "Louk": {"portfolio": {"balance": 0, "stocks": {}}}, "Reinder-Jan": {"portfolio": {"balance": 0, "stocks": {}}}, "loukdeloijer": {"portfolio": {"balance": 0, "stocks": {}}}}}
{"users": {"louk123": {"portfolio": {"balance": 500, "stocks": {"AAPL": {"quantity": 5, "price": 151.14}, "IBM": {"quantity": 1, "price": 1501.14}}}}, "luuk": {"portfolio": {"balance": 16060, "stocks": {"AAPL": {"quantity": 5, "price": 151.14}, "IBM": {"quantity": 1, "price": 1501.14}}}}, "Louk": {"portfolio": {"balance": 4800, "stocks": {}}}, "Reinder-Jan": {"portfolio": {"balance": 0, "stocks": {}}}, "loukdeloijer": {"portfolio": {"balance": 0, "stocks": {}}}}}
16 changes: 8 additions & 8 deletions PythonTrainingGroupB/menu_options.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from Portfolio import *

def investing_choice_menu(user_name, portfolios):
print(f"Welcome in the main menu user {user_name}! please type any of the options in the terminal to perform the listed actions.")
print(f"Welcome in the main menu user {user_name}! please type in the number of a menu option in the terminal to perform the action.")

print("========== Menu ==========")
print("= 1 view portfolio =")
Expand All @@ -12,9 +12,9 @@ def investing_choice_menu(user_name, portfolios):
print("= 6 exit game =")
print("==========================")

choice = input('Please type in the menu option:')
choice = input('Please type in the menu option number:')

if choice == "view portfolio" or int(choice) == 1:
if int(choice) == 1:
display_portfolio(user_name, portfolios)
return_choice = input("want to return to the menu? [yes, no]")
if return_choice == "yes":
Expand All @@ -24,7 +24,7 @@ def investing_choice_menu(user_name, portfolios):
else:
print("not a valid answer, returning to main menu")
investing_choice_menu(user_name, portfolios)
elif choice == "deposit money" or int(choice) == 2:
elif int(choice) == 2:
amount = int(input("How much money would you like to deposit to your balance?"))
add_money(user_name, portfolios, amount)
return_choice = input("want to return to the menu? [yes, no]")
Expand All @@ -35,7 +35,7 @@ def investing_choice_menu(user_name, portfolios):
else:
print("not a valid answer, returning to main menu")
investing_choice_menu(user_name, portfolios)
elif choice == "withdraw money" or int(choice) == 3:
elif int(choice) == 3:
amount = int(input("How much money would you like to withdraw from your balance?"))
withdraw_money(user_name, portfolios, amount)
return_choice = input("want to return to the menu? [yes, no]")
Expand All @@ -46,7 +46,7 @@ def investing_choice_menu(user_name, portfolios):
else:
print("not a valid answer, returning to main menu")
investing_choice_menu(user_name, portfolios)
elif choice == "buy stocks" or int(choice) == 4:
elif int(choice) == 4:
print("This functionality currently does not exist")
return_choice = input("want to return to the menu? [yes, no]")
if return_choice == "yes":
Expand All @@ -56,7 +56,7 @@ def investing_choice_menu(user_name, portfolios):
else:
print("not a valid answer, returning to main menu")
investing_choice_menu(user_name, portfolios)
elif choice == "sell stocks" or int(choice) == 5:
elif int(choice) == 5:
print("This functionality currently does not exist")
return_choice = input("want to return to the menu? [yes, no]")
if return_choice == "yes":
Expand All @@ -66,7 +66,7 @@ def investing_choice_menu(user_name, portfolios):
else:
print("not a valid answer, returning to main menu")
investing_choice_menu(user_name, portfolios)
elif choice == "exit game" or int(choice) == 6:
elif int(choice) == 6:
print("Exiting Investment Game, Thanks for playing")
else:
print("You did not type a valid menu choice")
Expand Down

0 comments on commit cc2add6

Please sign in to comment.