You are on page 1of 4

Write this code in python

1. Let R be the radius of a circle. Prepare a shell to execute Area and Perimeter of a circle?
2. Write a program file to execute cube root, fourth root, fifth root and Sixth root for a given
value.
3. Write a function and script file quadratic which accepts three values as the coefficients a,
b and c of quadratic equation, computes and returns the value of the corresponding roots
as x1 and x2.
Equation: 𝑎𝑥2+ 𝑏𝑥 + 𝑐

4. As of early 2018, Usain Bolt holds the world record in the men's 100-meter dash. It is
9.58 seconds. What was his average speed in km/h? Assign the result to a variable called
hundred.
5. Kenyan Eliud Kipchoge set a new world record for men of 2:01:39 on September 16,
2018. Assign his average speed in km/h to the variable marathon. The marathon distance
is 42.195 kilometers.
6. The program takes in the marks of 5 subjects and displays the grade and total marks.
7. Write a program to find smallest and biggest number out of given 3 numbers.
8. Write a program to check whether the given number is in between 1 and 100
9. Write a program which calculates the tip in the restaurant according to the amount of the
bill, if the bill is less than 10$ the tip is $1.80. If the bill is between $10 and $60 the tip is
18% of the bill, if the bill is above $60 the tip is 20% of the bill.

10. Write a function file for Global stiffness matrix


for a two-node element (one dimensional), where a is
cross-section area, e is young’s modulus, l is length
of the element and n is number of elements.
1. L = float(input('enter the Length'))
T = float(input('enter the time'))
S = T/L
print("SPEED OF THE BOLT",S*(18/5))

2. L = float(input('enter the Length'))


T = float(input('enter the time'))
S = T/L
print("SPEED OF THE MARATHON ",S)

logic: 42.195/((121*60)+39);

3. sub1=int(input("Enter marks of the first subject: "))


sub2=int(input("Enter marks of the second subject: "))
sub3=int(input("Enter marks of the third subject: "))
sub4=int(input("Enter marks of the fourth subject: "))
sub5=int(input("Enter marks of the fifth subject: "))
total = sub1+sub2+sub3+sub4+sub5
print(“Total Marks:”,total)
avg=(sub1+sub2+sub3+sub4+sub5)/5
if(avg>=90):
print("Grade: A")
elif(avg>=80&avg<90):
print("Grade: B")
elif(avg>=70&avg<80):
print("Grade: C")
elif(avg>=60&avg<70):
print("Grade: D")
else:
print("Grade: F")
4. n1 = int(input('Enter First number : '))
n2 = int(input('Enter Second number : '))
n3 = int(input('Enter Third number : '))

if (n1 > n2) and (n1 > n3):


print("The largest of the 3 numbers is : ", n1)
elif (n2 > n3):
print("The largest of the 3 numbers is : ", n2)
else:
print("The largest of the 3 numbers is : ", n3)
if (n1 < n2) and (n1 < n3):
print("The smallest of the 3 numbers is : ", n1)
elif (n2 < n3):
print("The smallest of the 3 numbers is : ", n2)
else:
print("The smallest of the 3 numbers is : ", n3)

5. n = int(input('Enter First number : '))


if (n>= 1) and (n<=100):
print("The number",n,"is in between 1 to 100")
else:
print("The number",n,"is not in between 1 to 100")
6. PI = 3.14
radius = float(input(' Please Enter the radius of a circle: '))
area = PI * radius * radius
circumference = 2 * PI * radius
print("Area of a circle:",area)
print("circumference of a circle:",circumference)
7. import cmath
a = float(input('Enter a: '))
b = float(input('Enter b: '))
c = float(input('Enter c: '))
d = (b**2) - (4*a*c)
x1 = (-b-cmath.sqrt(d))/(2*a)
x2 = (-b+cmath.sqrt(d))/(2*a)
print(" x1 value ",x1)
print(" x2 value ",x2)

You might also like