1. Write a python program to print “Hello World, Happy Learning Python.
print("Hello World, Happy Learning Python")
2. Write a python program to read any name and print just adding Hi before to it.
a = input("Enter your name :")
print("Hi"+a)
3. Develop python code to print the below as it is on the screen,
Hi “Welcome” to RGUKT’s family \ IIIT-S \
This is ‘second’ line.
This is ‘’’third’’’ line.
print("\"WELCOME\" to RGUKT's family \\ IIIT-S \\ \nThis is 'second' line \nThis is 'second' line")
4. Develop Python Code to read an integer,string and special symbol(<,@,!,#,$,%,^,&,*,(,),>,|,/,+)form the keyboard/console then output should be
inputs are – 3, hi, $
output is - $$$hi$$$
a = int(input())
b = input()
c = input()
print(a*c+b+a*c)
5. Develop Python Code to read any single character from keyboard and print its ASCII value, similarly read any number between 0-255 and print its related ASCII character.
a = input("Enter any single character :")
print(ord(a))
b = int(input("Enter any number between 0-255"))
if 0 <= b <= 255:
print(chr(b))
else:
print("Invalid input")
6. Read a floating point number and an integer, print the numbers digits after decimal point based on that integer.
a = float(input())
b = int(input())
print(round(a,b))
7. Develop Python Code to evaluate the the below expression (45-20+(10/5)%5*3*4)
print(45-20+(10/5)%5*3*4)
8. Develop Python Code to evaluate sphere volume.
a = int(input("Enter radius of the sphere"))
print("volume of the sphere is :",(4/3)(22/7)(a**3))
9. Write a Python Program to read an integer and print its binary, octal and hexa decimal format.
a = int(input("Enter any Number :"))
print("Binary form of input is :",bin(a),"\nOctal form of input is :",oct(a),"\nHexa form of input is :",hex(a))
10. Develop Python Code to read a number and print its square, cube and square root.
a = int(input())
print("Square of input is :",a**2,"Cube of input is :",a**3,"Square root of input is :",a*(1/2))
11. Write a Python Program to repeat the string ‘‘RGUKT” n times. Here ‘n’ is an integer entered by the user.
n = int(input())
print("RGUKT"*n)
12. Read any number form console/keyboard and print it digits at ones place and tens place.
a = int(input("Enter any Number :"))
print(a%100)
13. Write a Python Program to read two numbers say x and y, print the remainder, quotient, Xy and Yx
x = int(input("Enter any Number"))
y = int(input("Enter any Number"))
print("remainder",x%y,"quotient",x/y,"x power y",x**y,"y power x",y**x)
14. Develop Python Code python code to read different data types and print them on screen by mentioning the type.
a = "Hello World"
b = 20
c = 20.623
d = 1j
e = ["apple", "banana", "cherry"]
f = ("apple", "banana", "cherry")
g = range(6)
h = {"name" : "John", "age" : 36}
i = {"apple", "banana", "cherry"}
j = frozenset({"apple", "banana", "cherry"})
k = True
l = b"Hello"
m = bytearray(5)
n = memoryview(bytes(5))
o = None
print(type(a),type(b),type(c),type(d),type(e),type(f),type(g),type(h),type(i),type(l),type(k),type(l),type(m),type(n),type(o))
15. Develop Python Code to read any two numbers from console and perform arithmetic operations on them.
a = int(input())
b = int(input())
print("Addition :",a+b,"Substraction :",a-b,"Multiplication :",a*b,"Division :",a/b)
16. Develop python code to evaluate Herons theorem. √ s (s−a)( s−b)( s−c )
a = float(input())
b = float(input())
c = float(input())
s = (a+b+c)/2
print
((s*(s-a)*(s-b)*(s-c))**(1/2))
17. Develop python code to convert seconds to Hrs:Min:Sec format.
a = int(input())
b = a//3600
c = (a%3600)//60
d = (a%3600)%60
print(b,"Hours:",c,"Minutes",d,"Seconds")
18. Develop python code to convert temperature celcious to farenheit.
a = float(input("Enter temperature in celcius"))
print(32+(1.8*a))
19. Develop python code to convert speed m/s to k/h.
a = float(input("Enter M/s :"))
print(a*3.6,"k/h")
20. Develop python code to read an amount then calculate the number of denominations of 2000 rs notes, 500 rupee nots and 200 rupee notes.
a = int(input("Enter amount :"))
b = a // 2000
c = (a%2000)//500
d = ((a%2000)%500)//200
print(b,"2000 notes",c,"500 notes",d,"200 notes")
21. Develop python code evaluate Simple interest ( SI = (p x t x r)/100
p = int(input("Enter Principle amount :"))
r = int(input("Enter rate of interest per annum :"))
t = int(input("Enter time period in years :"))
print("Simple interest =",(p*t*r)/100)
22. Develop python code to swap two variables by using a third variables.
a = int(input("Enter a value for a :"))
b = int(input("Enter a value for b :"))
c = a
a = b
b = c
print(a,b)
23. Write a Python program to convert height (in feet and inches) to centimeters.
a = float(input("Enter height in feet and inches :"))
print("Your height is ",a*30.48,"cm")
24. Develop python code to swap two variables Without using a third variables.(for integers only)
a = int(input("Enter a value for a :"))
b = int(input("Enter a value for b :"))
print(a,b)
a = a + b
b = a - b
a = a - b
print("This is the value of a after swaping ",a,"This is the value of b after swaping ",b)
25. Develop python code to swap values of two variables using XOR.
a = int(input("Enter a value for a :"))
b = int(input("Enter a value for b :"))
print("a :",a,"b :",b)
a = a^b
b = a^b
a = a^b
print("a after swapping",a,"b after swapping")
26. Develop Python Code to solve quadratic equation.
a = float(input("Enter the coefficient of x2 :"))
b = float(input("Enter the coefficient of x :"))
c = float(input("Enter the constant value :"))
d = ((-b)-((b*2)-4*a*c)(1/2))/2*a
e = ((-b)+((b2)-4*a*c)*(1/2))/2*a
print("the value of x1",d,"The value of x2 :",e)
27. Develop Python Code to calculate distance between two points.
a = int(input("Enter x1 :"))
b = int(input("Enter y1 :"))
c = int(input("Enter x2 :"))
d = int(input("Enter y2 :"))
print("Distance between two points :",(((c-a)*2)+((d-b)2))*(1/2))
28. Develop Python Code to find diameter, circumference and Area of a Circle.
r = int(input("Enter radius of the circle :"))
print("Diameter of the circle :",r*2,"\nCircumference of the circle :",2*(22/7)r,"\nArea of a circle :",(22/7)(r**2))
29. Develop Python Code to find area of an isosceles triangle.
a = float(input("Enter lenght of the equal sides :"))
b = float(input("Enter lenght of the third side :"))
c = ((a*2)-((b2)/4))*(1/2)
print("Area of the Triangle is :",(b*c)/2)
30. Develop Python Code to find divisor if remainder and quotient is given. (dividend = divisor x quotient + remainder).
a = int(input("Enter Divident"))
b = int(input("Enter Quotient"))
c = int(input("Enter Remainder"))
print("Divisor is :",(a-c)/b)
31. Develop Python Code to find the sum of squares of first n natural numbers.
n = int(input())
m = (n*(n+1)*(2*n+1))/6
print("The sum squares of n natural numbers :",m)
32. Develop Python Code to convert hours into minutes and seconds.
a = int(input())
print(a*60,"Minutes",a*3600,"Seconds")
33. Develop Python Code to determine student result pass/fail based on his Internal and external marks,Internal marks weightage is 40% and External marks weightage is 60%, a student has to get greater than or equal to 75% to pass the exam( Internal exam conducted for 100 marks,external exam conducted for 75 marks).
a = float(input("Enter marks in external exam (out of 75) :"))
b = float(input("Enter marks in internal exam (out of 100) :"))
if 0 <= a <= 75 and 0 <= b <= 100:
c = a/75*100
d = b/100*100
e = c/100*60
f = d/100*40
if e+f >= 75:
print("Pass with "+str(e+f)+"%")
else:
print("Fail with "+str(e+f)+"%")
else:
print("Invalid input")
34. Develop Python Code to find HCF/GCD if two integer and LCM are inputs.
a = int(input("Enter first integer :"))
b = int(input("Enter second integer :"))
c = int(input("Enter LCM of two integers (correctly) :"))
print("HCF/GCD is :",(a*b)//c)
35. Develop Python Code to print a bill based on purchase.( Items are idly-5rs , dosa-20rs , poori-10rs,chapati-20rs)
Example if a customer purchase 1 idly , 1 dosa, 2 chapati.
print("Enter item (idly,dosa,poori,chapati):")
a = int(input("How many idly's do you want to buy ? :"))
b = int(input("How many dosa's do you want to buy ? :"))
c = int(input("How many poori's do you want to buy ? :"))
d = int(input("How many chapati's do you want to buy ? :"))
print('\t\t'," Total")
print('\t\t','-'*10)
print('Item\t\tQuantity\t\tAmount')
print('-'*50)
if a > 0:
print('Idly\t\t',a,'\t\t\t',a*5)
if b > 0:
print('dosa\t\t',b,'\t\t\t',b*20)
if c > 0:
print('poori\t\t',c,'\t\t\t',c*10)
if d > 0:
print('chapati\t\t',d,'\t\t\t',d*20)
print('-'*50)
print('Total\t\t',a+b+c+d,'\t\t\t',(a*5)+(b*20)+(c*10)+(d*20))

*Questions Prepared by--Srikanth.D

Mentor in IT,Dept of IT,RGUKT-SRIKAKULAM
duppada8@rguktsklm.ac.in

35

Projects

300

Minutes Of Support

5

Hard Worker