1.
Find the error in the following code:
(a) y = x +5
(b) a=input(“Value: “)
print(x,y) b = a/2
print( a, b)
(c) print(x = y = 5)
2. Predict the output of the following:
3. What will be the output of the following?
4. Shiv has written following code into python but he is not able to get the
correct output.
n=int(“Enter number”)
triple=n**3
Print(“Number three times:”,n)
Identify the syntax and logical errors and write the correct code. Underline
each correction.
5. Do as directed:
i. Assign 5 to a variable x.
ii. Write statement to compute the square of given number a.
6. What will be the output of the following?
a) print(“Bhavans\nNewsprint\nVidyalaya”)
b) print(“Bhavans\nNewsprint\tVidyalaya”)
c) print(“Bhavans”,Newsprint”,”Vidyalaya”,sep=”\n”)
d) print(“Bhavans”,Newsprint”,”Vidyalaya”,sep=”\t”)
e) print(“Bhavans”,Newsprint”,”Vidyalaya”,end=”lt”)
f) print(“Bhavans”,Newsprint”,”Vidyalaya”,end=”!”)
7. What is the default value of Sep and end?
8. Predict output
if 4 + 5 == 10:
print("TRUE")
else:
print("FALSE")
print("TRUE")
9. Predict output
x=5
if (x > 2):
x=x*2
if (x > 4):
x=0
print(x)
10. Predict output
x=5
if (x > 2):
x=x*2
elif (x > 4):
x=0
print(x)
11. Predict output
I. True and False
II. False or True
III. False and (True or False)
11. What is the output from the following code?
a=3
b = (a! = 3)
print (b)
12. Program to accept salary of an employee and calculate the tax amount as
per the following conditions.
Salary > 70000 : 8% of salary
Salary > 60000 : 7% of salary
Salary > 50000 : 5% of salary
Else No tax
13. Display three string “Name”, “Is”, “James” as “Name**Is**James”.
14. Calculate the product and sum of two numbers.
15. Write a program to accept two whole numbers from the user and print it.
16. Write a program to accept two float numbers from the user and print it.
17. Write a program to accept two Strings from the user and print it.