Answered step by step
Verified Expert Solution
Question
1 Approved Answer
from pe1: while tries = 0: # add amount to account account += amount print(f'After Deposit new balance is {account : .2f}') else: print(fInvalid entry.
from pe1:
while tries = 0: # add amount to account account += amount print(f'After Deposit new balance is {account : .2f}') else: print(f"Invalid entry. Please try again.") # end of transaction loop # end of application loopLearning Outcomes 1. Write decisions and loops to satisfy requirements. 2. Implement data structures such as lists, tuples, and/or dictionaries 3. Work with user input 4. Utilize the random module to generate random numbers and choices Program Overview The Bank client would like to add the following features to the system: 1. New users shall be able to create a new account if they would like to 2. New users can create a new pin themselves or let the system create a new pin randomly for them. 3. For users who would like to create a new pin themselves, display a message to let them know the pin needs to be an integer between 1 and 9999. Validate the pin a user entered. 4. The user has 3 tries to create a new pin between 1 and 9999. If all tries failed, the program will exit. Display a friendly message to encourage the user to visit again. 5. After the user successfully created a pin, save the username and the new pin. Instructions Create a PyCharm Project, and name the project PE2_[ASUrite). e.g. PE2_selin2 Put your name, class. class time, and assignment number in as a comment on Line 1 of the transaction.py. Recall # is used to start single line comments. Create a python file named [ASUrite]_transaction2.py per naming conventions. 1. Import modules. A module is a single python file and importing modules allows the use of functions, classes, and global variables/objects that reside in other python files. Another term used in this context is a package which is a namespace or collection of python modules. Packages are folders that contain a _init__.py file. This application will make use of two modules os and random. Add code below: import os import random 4. Write an if statement to see if the username entered is already in the users dictionary. As an example: if user in users: pin = users[user) 5. If the user is in the users dictionary, then continue with the code we created in PE1 to ask the user to enter the pin and make transactions 6. If the user is not in the users dictionary: 6.1. Print out a message to let the customer know that he/she doesn't have an account with the Bank. 6.2. Print out another message to ask the customer if he/she would like to have an account with the bank 6.2.1 If the customer entered 'yes', 'Yes', 'y', or "Y", then ask the user if he/she would like to enter a new pin or to have the system create a new pin 6.2.1.1. The user gets 3 chances to pick a pin between 1 to 9999. 6.2.1.2. If the customer would like to have the system create a new pin, the system will randomly create a pin between 1 to 9999 6.2.2 If the customer entered anything else, print out an inspiring message to encourage the customer to come back again, then exiting the program. 6.3. Save the new username and pin to users dictionary when the pin was successfully created. Assignment-specific Submission Instructions (if any) Follow standard submission instructions (see course website Week 1 -> Assignment Help Guide... and then the Assignment Submission Instructions area). 1. Submit your [ASUrite]_transaction.py module only and do not submit a zip file submission. Zip file submissions will only be requested for larger programs we create later in this course. In the first portion of the course, you will be submitting the module only. Ensure you read instructions carefully to ensure you submit correctly. Welcome to Cactus Bank. Please enter your username: Emma Emma, Didn't find your username. Do you want to create an account (Y/N)? y Enter 1 to create a pin yourself or 2 and the system will create a pin for you: 1 Select a number between 1 and 9999 as your pin: -20 -20 Invalid pin entered. Select a number between 1 and 9999 as your pin: 1000000 1886080 Invalid pin entered. Select a number between 1 and 9999 as your pin: 999 999 Please remember your pin. The system will require you to enter it again. Press Enter to continue
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started