Computer Science, asked by 3124567890agh, 1 month ago

Write a python program to accept price of an item and number of units sold. Finally

display the amount payable.

Answers

Answered by kayamramya2005
5

Answer:

Question 1

Write a program which asks user to enter price and quantity of a product. Your program should calculate and display the the bill amount as price * quantity. If bill amount is more than 2000 discount of 20% on bill amount should be subtrated from bill.

Program

price = int(input('Enter price of product: ')) quantity = int(input('Enter quantity: ')) amount = price * quantity if amount > 2000: discount = amount*0.20 else: discount = 0 net_amount = amount - discount print('Bill amount:',amount) print('Discount:',discount) print('Your net bill amount is',net_amount)

Output

Enter price of product: 550 Enter quantity: 4 Bill amount: 2200 Discount: 440.0 Your net bill amount is 1760.0

Question 2

The marks obtained by a student in computer science is input by the user. Your program should display the grade. The student gets a grade as per the following rules:

marks Grade 90-100 A 80-89 B 70-79 C 60-69 D 0-59 F

Program

marks = int(input('Enter your marks in CS: ')) if marks>=90: grade = 'A' elif marks>=80: grade = 'B' elif marks>=70: grade = 'C' elif marks>=60: grade = 'D' else: grade = 'F' print('Your grade is',grade)

Output

Enter your marks in CS: 67 Your grade is D

Similar questions