Simple programs
1,
a = 5
b = 4
print ( a+b)
-----------------------------------------------------------------------------------------
2.
a = "Hello"
b ="World"
print ( a + b )
------------------------------------------------------------------------------------------
3.
x, y, z = ( 5, 6, 7)
print(x)
-------------------------------------------------------------------------------------------
4. x is global variable and local variable.x = 'awesome'
def myfunc():
x = 'fantastic'
myfunc()
print('Python is ' + x)
What will be the printed result?
-------------------------------------------------------------------------------------------
5.
def myfunc()
global x
x = "fantastic"
-------------------------------------------------------------------------------------------
6.x = 'awesome'
def myfunc():
global x
x = 'fantastic'
myfunc()
print('Python is ' + x)
-------------------------------------------------------------------------------------------
7.
If x = 5, what is a correct syntax for printing the data type of the variable x?
print(type(x))
-------------------------------------------------------------------------------------------
8.
x = "Hello World"
print(type(x))
ans : str
-------------------------------------------------------------------------------------------
9.
x = 20.5
print(type(x))
-------------------------------------------------------------------------------------------
10.
x = ["apple", "banana", "cherry"]
print(type(x))
ans : list
-------------------------------------------------------------------------------------------
11.
x = ["apple", "banana", "cherry"]
print(x)
-------------------------------------------------------------------------------------------
12.
x = ("apple", "banana", "cherry")
print(type(x))
ans : tuple
-------------------------------------------------------------------------------------------
13.
x = {"name" : "John", "age" : 36}
print(type(x))
ans : dict
-------------------------------------------------------------------------------------------
14.
x = True
print(type(x))
ans : bool
-------------------------------------------------------------------------------------------
15.
What will be the printed result?
Comments
Post a Comment