1. Accept a number. If number is positive, then find cube of the number else find square of
number. If number is 0, display 0.
2. Find area of a rectangle. [Formula: L*B]
3. Accept the marks of test1, test2 and test3 and find the average of these marks.
[Formula: Average = sum of the marks/ no. of tests]
4. Input two numbers A and B. If A is greater than B, then find the difference between A
and B else find sum of A and B.
5. Write a program to accept weight in Kg and convert it into Pounds. (1 Kg = 2.205
pounds)
6. Find whether an angle is acute or obtuse angle. (A<90 o acute angle, A> 90 o obtuse angle)
7. Accept the age of a person and display a message whether the person is eligible to vote.
(If age is greater than 18, then eligible to vote).
8. Accept 3 angles A, B and C. Check whether a triangle can be created from these 3 angles.
(Triangle is possible if A+B+C = 180 o )
9. Accept user’s choice X and integer value N. If X = 1 then find area of circle with N as
radius [Formula- Area = 3.14 * N * N] else find area of square with N as side. [Formula-
Area=N * N].
10. Accept bill amount. If amount is greater than 1000 give 10% discount else give discount
of Rs.100. Display the discount and the final bill amount.
[Formula: discount = bill_amount * 10/100
final_bill_amount = bill_amount – discount]
pleasee answer if you do know the question or know which site can answer my question pleaase comment.
Answers
mark me as brainlest please
Python programming language is used to write the programs of the questions.
1. Accept a number. If number is positive, then find cube of the number else find square of number. If number is 0, display 0.
x = int(input("Enter a Number: "))
if x == 0:
print("0")
elif x > 0:
print(x * x * x)
elif x < 0:
print(x * x)
2. Find area of a rectangle. [Formula: L*B]
L = int(input("Enter length of rectangle: "))
B = int(input("Enter breadth of rectangle: "))
print("Area of rectangle is", L * B)
3. Accept the marks of test1, test2 and test3 and find the average of these marks. [Formula: Average = sum of the marks/ no. of tests]
test1 = int(input("Enter marks of test1: "))
test2 = int(input("Enter marks of test2: "))
test3 = int(input("Enter marks of test3: "))
print("Average marks is", (test1 + test2 + test3)/3)
4. Input two numbers A and B. If A is greater than B, then find the difference between A and B else find sum of A and B.
A = int(input("Enter the first number: "))
B = int(input("Enter the second number: "))
if A > B:
print("A is greater than B so, the difference between A and B is", A - B)
else:
print("A is equal to or smaller than B so, the sum of A and B is", A + B)
5. Write a program to accept weight in Kg and convert it into Pounds. (1 Kg = 2.205 pounds)
weight = int(input("Enter the weight in Kg: "))
print("The weight in Pounds is", weight * 2.205)
6. Find whether an angle is acute or obtuse angle. (A < 90 degree acute angle, A > 90 degree obtuse angle)
angle = int(input("Enter the angle to find type of angle: "))
if angle < 90:
print(angle, "degrees is an acute angle")
elif angle > 90:
print(angle, "degrees is an obtuse angle")
elif angle == 90:
print(angle, "degrees is a right angle")
7. Accept the age of a person and display a message whether the person is eligible to vote. (If age is greater than 18, then eligible to vote).
age = int(input("Enter the age to find if you are eligible to vote or not: "))
if age > 18:
print("You are eligible to vote.")
else:
print("You are not eligible to vote.")
8. Accept 3 angles A, B and C. Check whether a triangle can be created from these 3 angles. (Triangle is possible if A+B+C = 180 degrees)
angleA = int(input("Enter angle A: "))
angleB = int(input("Enter angle B: "))
angleC = int(input("Enter angle C: "))
if (angleA + angleB + angleC) == 180:
print("Triangle is possible.")
else:
print("Triangle is not possible.")
9. Accept user’s choice X and integer value N. If X = 1 then find area of circle with N as radius [Formula - Area = 3.14 * N * N] else find area of square with N as side. [Formula - Area=N * N].
X = int(input("Enter a number: "))
N = int(input("Enter a number: "))
if X == 1:
print("Area of circle is", 3.14 * N * N)
else:
print("Area of square is", N * N)
10. Accept bill amount. If amount is greater than 1000 give 10% discount else give discount of Rs.100. Display the discount and the final bill amount.
[Formula: discount = bill_amount * 10/100
final_bill_amount = bill_amount – discount]
billAmount = int(input("Enter the bill amount: "))
if billAmount > 1000:
discount = (billAmount * 10)/100
print("The final bill amount is", billAmount - discount)
else:
print("The final bill amount is", billAmount - 100)
Write about Python?
Python is created by Guido van Rossum and it came into existence in 1991. It is high-level and general programming language. It is a very lucid programming language as it has good language construct and object oriented approach. It is dynamically typed and garbage-collected.