Instagram
youtube
Facebook
Twitter

Python Discount Program Codechef Solution

           Python Discount Programme Codechef Solution

Problem

Alice buys a toy with a selling price of 100 rupees. There is a discount of x percent on the toy. Find the amount Alice needs to pay for it.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • The first and only line of each test case contains a single integer, x—tthe discount on the toy.

Output Format

           For each test case, output on a new line the price that Alice needs to pay.

Constraints

  • 1≤T≤100
  • 0<=x<=100

Sample Input:

11 

21

Sample Output:

95 

91 

89 

79

Explanation:

Test case 1: The discount is 5 percent, i.e., 5 rupees. So, Alice will have to pay 1005 = 95 rupees.

           Solution:

t = int(input(“Enter the number of terms: “))

for i in range(t):

    x = int(input(“Enter the discount: “))

    print(100-x)

 

Steps to solve this problem:

  1. Ask the user to enter the number of the terms.
  2. In the loop, ask the user to enter the discount.
  3. Calculate the discounted rate after deducting the discount from the actual price and print it.