DEV Community

varatharajan
varatharajan

Posted on

Task

Task 1:

Create a python module called Bank.
Add functions: deposit(amount), withdraw(amount)
Create one more python module called Customer
From customer module, call deposit and withdraw functions of Bank module.

bank.py

def deposit(amount):
    print("Total deposit amount is ",amount)
    return(amount)

def withdraw(amount):
    print("Total withdrawal amount is ",amount)
    return(amount)
Enter fullscreen mode Exit fullscreen mode
#customer.py

import Bank

total_deposit=Bank.deposit(200000)
total_withdrawal=Bank.withdraw(20000)

print("Bank balance is ",(total_deposit-total_withdrawal))
Enter fullscreen mode Exit fullscreen mode

output


Total deposit amount is 200000
Total withdrawal amount is 20000
Bank balance is 180000

predefined modules:

random :

input

import random
otp = random.randint(0,9999)
print(otp)
Enter fullscreen mode Exit fullscreen mode

output


4321
3185
4238

math

input

import math
print(math.sqrt(9))
Enter fullscreen mode Exit fullscreen mode

output

3.0

Top comments (0)