Fun with Statistics Part II In this practice program, you will be modify the program you wrote for Practice 5 - Fun with Statistics, to append the user input to a list. When the user is done entering

# Welcome to Mula Bank




# Enter 'start' to begin or 'exit' to leave: start


#


# Enter user ID: any_user_id


# Enter password: any_password


#


# Login successful!


#


# 1. View Balance


# 2. Deposit


# 3. Withdraw


# 4. Exit


#


# Enter your choice: 1


# Your current balance is: $500.00


#


# Enter your choice: 2


# Enter deposit amount: 200


# Deposit successful. Your new balance is: $700.00


#


# Enter your choice: 3


# Enter withdraw amount: 100


# Withdrawal successful. Your new balance is: $600.00


#


# Enter your choice: 4


# Do you want a receipt? (yes/no): yes


# Here is your receipt. Your final balance is: $600.00


#


# Thank you for using Mula Bank. Goodbye!




def front_page():


"""


Displays the front page with a welcome message and prompts the user to start or exit.


"""


print("Welcome to Mula Bank")


while True:


start = input("\nEnter 'start' to begin or 'exit' to leave: ").lower()


if start == 'start':


break


elif start == 'exit':


print("Thank you for visiting Mula Bank. Goodbye!")


exit()


else:


print("Invalid input. Please enter 'start' or 'exit'.")






def login():


"""


Prompts the user to log in with a user ID and password.


Any entered user ID and password are accepted as valid.


"""


print("Please log in to continue.")


while True:


entered_user_id = input("Enter user ID: ")


entered_password = input("Enter password: ")


# Accept any user ID and password as valid


print("\nLogin successful!\n")


break






def print_welcome():


"""


Prints the main menu options to the user.


"""


print("\n1. View Balance")


print("2. Deposit")


print("3. Withdraw")


print("4. Exit")






def get_user_input(prompt, input_type):


"""


Prompts the user for input and returns it converted to the specified type.




Args:


prompt (str): The input prompt to display to the user.


input_type (type): The type to convert the input to (int or float).




Returns:


input_type: The user input converted to the specified type.


"""


while True:


try:


return input_type(input(prompt))


except ValueError:


print(f"Invalid input. Please enter a valid {input_type.__name__}.")






def get_choice():


"""


Prompts and returns a valid menu choice.




Returns:


int: The user's menu choice (1-4).


"""


while True:


choice = get_user_input("Enter your choice: ", int)


if 1 <= choice <= 4:


return choice


print("Invalid choice. Please enter a number between 1 and 4.")






def get_deposit_amt():


"""


Prompts and returns a valid deposit amount.




Returns:


float: The user's deposit amount (>= 0).


"""


while True:


amount = get_user_input("Enter deposit amount: ", float)


if amount >= 0:


return amount


print("Deposit amount must be non-negative.")






def get_withdraw_amt(balance):


"""


Prompts and returns a valid withdrawal amount.




Args:


balance (float): The current balance of the user.




Returns:


float: The user's withdrawal amount (0 <= amount <= balance).


"""


while True:


amount = get_user_input("Enter withdraw amount: ", float)


if 0 <= amount <= balance:


return amount


print(f"Invalid amount. Please enter a value between 0 and {balance}.")






def ask_for_receipt(balance):


"""


Asks the user if they want a receipt and prints it if requested.




Args:


balance (float): The final balance of the user.


"""


while True:


receipt = input("Do you want a receipt? (yes/no): ").lower()


if receipt == 'yes':


print(f"Here is your receipt. Your final balance is: ${balance:.2f}")


break


elif receipt == 'no':


break


else:


print("Invalid input. Please enter 'yes' or 'no'.")






def main():


"""


Main function to drive the program.


"""


front_page()


login()


balance = 500.0 # Initial balance




while True:


print_welcome()


choice = get_choice()




if choice == 1:


print(f"Your current balance is: ${balance:.2f}")


elif choice == 2:


deposit = get_deposit_amt()


balance += deposit


print(f"Deposit successful. Your new balance is: ${balance:.2f}")


elif choice == 3:


withdraw = get_withdraw_amt(balance)


balance -= withdraw


print(f"Withdrawal successful. Your new balance is: ${balance:.2f}")


elif choice == 4:


ask_for_receipt(balance)


print("Thank you for using Mula Bank. Goodbye!")


break






if __name__ == "__main__":


main()