def fun(n):
n+=n
return
print(fun(5))
x = '123463'
d = x[1] + x[4]
print(d)
Numbers with the 0x prefix are treated as hexadecimal numbers.
What is the output of the following code:
L = ['s', 't', 'u', 'v']
print("".join(L))
What will be the output of the following Python code?
print('xyyzxxyxyy'.lstrip('xyy'))
Which of these is a private data field?
def Demo:
def __init__(self):
__a = 1
self.__b = 1
self.__c__ = 1
__d__= 1
What will be the output of the following Python code?
a={1:"A",2:"B",3:"C"}
b=a.copy()
b[2]="D"
print(a)
time.struct_time(tm_year=2017, tm_mon=6, tm_mday=25, tm_hour=18, tm_min=26, tm_sec=6, tm_wday=6, tm_yday=176, tm_isdst=0)
Code:
import time
t=time.localtime()
print(t)
To extract only the year from this, we can use the function:
What will be the output of the following code?
a = ('python', 'java', 'ruby', 'css', 'html')
b = ('abekus',) * 5
c = b[3]
print(c)
print(b)