# Have you tried writing the same program multiple ways? 
# If yes, can you tell me about them? 
# Do you end up using all the programs or pick one over the other? Why?
# Let's explore the same with some of the programs you have written in this session
'''Task 1: Banking Transaction'''
print("**** Task 1: ****")
print()
# Write a program that computes account balance for a customer based inputs from the customer. 
# Your program must provide three choices.
# If the customer chooses, D then it would mean a deposit [Hint: You need to add this to the net amount]
# If the customer chooses, W then it would mean a withdraw [Hint: You need to subtract this from the net amount]
# If the customer chooses, Q then you should display the account balance and quit
# If any other key is pressed, print an error message.
# At any point the customer can make two consecutive entries.
print("**** Task 1: ****")
print("***** Bank Transaction ****")
ctr =1
net_amt=3000
while(ctr<=2):
 ch=input("Do you want to\n1.Deposit(Press D)\n2.Withdraw (Press W)\n3.Quit (Press Q)\n4.View Balance (Press V)")
 ctr=ctr+1
 if ch=="D" or ch=="d":
   amt=float(input("Enter amount to deposit:"))
   net_amt=net_amt+amt
 elif ch=="W" or ch=="w":
   amt=float(input("Enter amount to withdraw:"))
   net_amt=net_amt-amt 
 elif ch=="Q" or ch=="q":
   break
 elif ch == "v" or ch == "V":
   break
 else:
   print("ERROR Select either D , W or Q") 
print("Your total balance is :", net_amt)



'''Task 2: Research Assignment'''
# Of the programs you have done so far, in this session, 
# Identify two programs that you can write without using the “While” loop
# What is the difference in the program you have written with and without the “while” loop
# Run both the programs and see the time taken for execution, for the given same inputs
# Write down all you have researched in a Word document and be ready to share the same with your teacher. 
    # OLD
    # start = 120
    # x = 120
    # time = 0
    # counter = 1
    # while counter != 0:
    #     for i in range(counter):
    #         time +=2
    #         x+=10
    #         if x == 350:
    #             counter = 0
    # print(f"It took {time} minutes for the oven to reach a temperature of 350 degrees.")
    
    
    # This program took 3.32 seconds to run.
    # NEW
    # start = 120
    # x = 120
    # time = 0
    # remain = 350-x
    # remain = remain/10
    # time = remain * 2
    # print(f"It took {time} minutes for the oven to reach a temperature of 350 degrees.")
    
    # This program took 3.12 seconds to run. 
    # I believe this is caused because the second one is just a simple mathematical formula while the first one is forcing it to repeat through a while loop.

'''Great! You are super comfortable with the while loop. Great going!!'''

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: