Sunday, July 14, 2019

An electricity board charges according to the following rates:

For the first 100 units -   40 paisa per unit.
For the next 200 units -   50 paisa per unit.
beyond 300 units -  60 paisa per unit.
All users are charged meter charges also, which are Rs. 50/-

unit = float(input("Enter  Unit = "))
rs = 0.00
if (unit<100):
rs = (unit * 0.40)
elif(unit <= 300 and unit > 100):
rs = 40+((unit-100)*0.50);
elif(unit>300):
rs=140+((unit-300)*0.60);
rs = rs + 50
print("total bill = " + str(rs))

WAP to input the salary of a person and calculate the hra and da according to the following conditions:

conditions:

  • Salary HRA DA
  • 5000-10000 10%       5%
  • 10001-15000 15%       8%


salary = float(input("Enter Salary = "))
print('-'*20)
if (salary >= 5000  and salary <=10000):
print("HRA = " + str((salary * 10)/100))
print("DA = " + str((salary * 5)/100))
elif(salary >= 10001  and salary <=15000):
print("HRA = " + str((salary * 15)/100))
print("DA = " + str((salary * 8)/100))
else:
print(" invalid salary ")

WAP to input the name and age of a person and display “CHILD”,“TEENAGER” or "ADULT" according to the age.

age = int(input("Enter age = "))
print('-'*20)
if (age >= 1  and age <= 12 ):
print(str(age) + " is a CHILD ")
elif(age >=13 and age <=19 ):
print(str(age) + " is a TEENAGER")
else:
print(str(age) + " is a ADULT")

WAP to input a number and check that number is divisible by 7 or not.

number = int(input("Enter Number = "))
print('-'*20)
if(number % 7 == 0):
print(str(number) + " is divisible by 7")
else:
print(str(number) + " is not divisible by 7")

WAP to input a number and check whether it is even or odd.

number = int(input("Enter number = "))
print('-'*20)
if (number % 2 == 0):
print(str(number)+ " is even number.")
else:
print(str(number) + " is odd number.")

WAP to check that a given year is a leap year or not.

year = int(input("Enter Year = "))
print('-'*20)
if (year % 400 == 0):
print(str(year) + " is a leap year.")
elif (year % 100 == 0):
print(str(year) + " isn't a leap year.")
elif(year % 4 == 0):
print(str(year)+ " is a leap year.")
else:
print(str(year) + " isn't a leap year.")

WAP to input the age of a person and check that he/she is eligible for license for not.

age = int(input("Enter Age = "))
print('-'*10)
if (age >=18):
print("he/she is eligible")
else:
print("he/she is not eligible")