Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	PythonTrainingGroupB/accounts.json
  • Loading branch information
ljonkergouw committed Nov 25, 2022
2 parents 8db4778 + cc2add6 commit f09a941
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 25 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": {}}}}}
{"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": {}}}}}
78 changes: 54 additions & 24 deletions PythonTrainingGroupB/menu_options.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,72 @@
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("= view portfolio =")
print("= deposit money =")
print("= withdraw money =")
print("= buy stocks =")
print("= sell stocks =")
print("= exit game =")
print("= 1 view portfolio =")
print("= 2 deposit money =")
print("= 3 withdraw money =")
print("= 4 buy stocks =")
print("= 5 sell stocks =")
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":
if int(choice) == 1:
display_portfolio(user_name, portfolios)
print("You are now returning to the main menu")
investing_choice_menu(user_name, portfolios)
elif choice == "deposit money":
return_choice = input("want to return to the menu? [yes, no]")
if return_choice == "yes":
investing_choice_menu(user_name, portfolios)
elif return_choice == "no":
print("Exiting Investment Game, Thanks for playing")
else:
print("not a valid answer, returning to main menu")
investing_choice_menu(user_name, portfolios)
elif int(choice) == 2:
amount = int(input("How much money would you like to deposit to your balance?"))
add_money(user_name, portfolios, amount)
print("You are now returning to the main menu")
investing_choice_menu(user_name, portfolios)
elif choice == "withdraw money":
return_choice = input("want to return to the menu? [yes, no]")
if return_choice == "yes":
investing_choice_menu(user_name, portfolios)
elif return_choice == "no":
print("Exiting Investment Game, Thanks for playing")
else:
print("not a valid answer, returning to main menu")
investing_choice_menu(user_name, portfolios)
elif int(choice) == 3:
amount = int(input("How much money would you like to withdraw from your balance?"))
withdraw_money(user_name, portfolios, amount)
print("You are now returning to the main menu")
investing_choice_menu(user_name, portfolios)
elif choice == "buy stocks":
return_choice = input("want to return to the menu? [yes, no]")
if return_choice == "yes":
investing_choice_menu(user_name, portfolios)
elif return_choice == "no":
print("Exiting Investment Game, Thanks for playing")
else:
print("not a valid answer, returning to main menu")
investing_choice_menu(user_name, portfolios)
elif int(choice) == 4:
print("This functionality currently does not exist")
print("You are now returning to the main menu")
investing_choice_menu(user_name, portfolios)
elif choice == "sell stocks":
return_choice = input("want to return to the menu? [yes, no]")
if return_choice == "yes":
investing_choice_menu(user_name, portfolios)
elif return_choice == "no":
print("Exiting Investment Game, Thanks for playing")
else:
print("not a valid answer, returning to main menu")
investing_choice_menu(user_name, portfolios)
elif int(choice) == 5:
print("This functionality currently does not exist")
print("You are now returning to the main menu")
investing_choice_menu(user_name, portfolios)
elif choice == "exit game":
return_choice = input("want to return to the menu? [yes, no]")
if return_choice == "yes":
investing_choice_menu(user_name, portfolios)
elif return_choice == "no":
print("Exiting Investment Game, Thanks for playing")
else:
print("not a valid answer, returning to main menu")
investing_choice_menu(user_name, portfolios)
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 f09a941

Please sign in to comment.