Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Assignment 1: Introduction to Basic Python

Assignments:

Practice Set:

1. A cashier has currency notes of denomination 1, 5 and 10. Write python script to accept the
amount to be withdrawn from the user and print the total number of currency notes of each
denomination the cashier will have to give.

def notes_counter(amount):
notes_10 = total_amt // 10
amount %= 10 # Get the reminder for further calculations

notes_5 = amount // 5
amount %= 5

notes_1 = amount # The remaining amount will be given in ones


return notes_10, notes_5, notes_1

total_amt = int(input("Enter the amount to be withdrawn: "))

notes_10, notes_5, notes_1 = notes_counter(total_amt)

print(f"Notes of 10s: {notes_10}")


print(f"Notes of 5s: {notes_5}")
print(f"Notes of 1s: {notes_1}")

OUTPUT :

2. Write a python script to accepts annual basic salary of an employee and calculates and displays
the Income tax as per the following rules.

Basic: < 2,50,000 Tax = 0

Basic: 2,50,000 to 5,00,000 Tax = 10%

Basic: > 5,00,000 Tax = 20

def calculate_tax(salary):

salary = int(salary.replace(",", ""))

if salary < 250000:

tax = 0

elif salary >= 250000 and salary <= 500000:

tax = salary // 10

else:
tax = salary // 20

return tax

basic_salary = input("Enter your basic salary: ")

tax_amount = calculate_tax(basic_salary)

print(f"The total tax payable on {basic_salary} is {tax_amount}.")

3. Write python script to accept the x and y coordinate of a point and find the quadrant in which the

point lies.

4. Write a python script to accept the cost price and selling price from the keyboard. Find out if the

seller has made a profit or loss and display how much profit or loss has been made.

You might also like