Professional Documents
Culture Documents
PYTHON CODE
PYTHON OUTPUT
#Q2 Write a program to enter and store the name of three different cities in
three different variables and print all the contents of variables on the
console.
PYTHON CODE
PYTHON OUTPUT
run Program2")
print("Press 7")
PYTHON CODE
PYTHON OUTPUT
PYTHON CODE
PYTHON OUTPUT
#Q5 Q.5 Make a program for the employee data in the company and enter the
data. Find the data- type of each input. Use the conversion function for
converting data into desired form.
PYTHON CODE
'
PYTHON OUTPUT
#Q6 Change the conversion operator in above question with eval() and print the
data type of each input.
PYTHON CODE
PYTHON OUTPUT
#Q7. Write a program to read two numbers from the user. Apply bitwise &,| and
^ operator on them and display result.
PYTHON CODE
PYTHON OUTPUT
'''50/8
50//8
40%5
7%2
4**3'''
PYTHON CODE
PYTHON OUTPUT
#Q9 State the output of each of the following expressions, if each expression
is independent. Assume value X=5
'''X+=10
X-=4
X*=6
X**=2
X%=2
X/=2'''
PYTHON CODE
PYTHON OUTPUT
'''i = 10
j = 20
k = 40
m = 4
n = 5
expressions. (i) (i + i) * k
(ii) i + (j - n)
(iii) i*j/n
(iv) k/j//5
PYTHON CODE
PYTHON OUTPUT
'''A = True
B = True
C = True
D = False
expressions.
(i) print(A and B) (ii) print(B or C)
PYTHON CODE
PYTHON OUTPUT
'''if i<j:
i=j
else:
i=k
print(i,j,k)
What will be the above code print if the variables i, j and k have the
following values?
c) i=8,j=15 and k = 12
d) = 13,j=15 and k = 13
PYTHON CODE
PYTHON OUTPUT
#13. Enter the age of 3 people and display the youngest one?
PYTHON CODE
PYTHON OUTPUT
# Q14 Write a program to Prompt for a score between 0.0 and 1.0. If the Score
is
'''Out of Range, Print an Error. If the score is between 0.0 and 1.0, print a
grade
Score
Grade
>=0.9 A+
>=0.8 A
>= 0.7 B+
>=0.6 B
>=0.5 C
>=0.4 D
<0.4 F'''
PYTHON CODE
PYTHON OUTPUT
# Q15 Q:4 Write a program to calculate the electricity bill (accept number of
unit from user) in Delhi according to the following criteria
'''Unit Price
1) 250
2) 350
3) 150
4) 99'''
PYTHON CODE
PYTHON OUTPUT
# Q16 Write a program to accept the cost price of a bike and display the road
tax to be paid according to the following criteria:
>100000 15%
<=50000 5%'''
PYTHON CODE
PYTHON OUTPUT