Professional Documents
Culture Documents
Sample Question Paper Answers 20.5.23
Sample Question Paper Answers 20.5.23
Sample Question Paper Answers 20.5.23
x = int(input("Enter a number:"))
if abs(x) == x:
print("You entered a positive number")
else:
x = -1
print("Number made positive:", x)
execmain(
2. a. Similarity:
Both lists and dictionaries are used to
store data in Python.
Difference:
A list is an ordered collection of
elements while a dictionary is an
unordered collection of key-value pairs.
b. def checkval():
x = int(input("Enter a number:"))
if x % 2 == 0:
print(x, "should be positive")
elif x < 0:
pass
else:
print(x, "is odd")
checkval()
File.write("ABC")
File.close()