Write a python program to replace blank space to 1
a='1 0 0 1'
print(a.replace(' ', '1'))
Write a python program to explain the generator
def f11(x):
yield x+1
g=f11(8)
print(next(g))
Write a python program to replace blank space to 1
def f12(x):
yield x+1
print("test")
yield x+2
g=f12(9)
print(next(g))
Write a python program to replace blank space to 1
a = re.compile('[0-9]')
z= a.findall('3 trees')
print(z)
Write a python program to print current working directory
import os
print(os.getcwd())
Write a python program to print the ascii value of a string
print([ord(ch) for ch in 'abc'])
Write a python program to use extend in list/ append to a list
a=[13,56,17]
a.append([87])
a.extend([45,67])
print(a)
Write a python program to replace blank space to 1
my_string = 'balaji'
k = [print(i) for i in my_string if i not in "aeiou"]
print('Not a vowel',k)
Write a python program to add and square a range of number
x = [i**+1 for i in range(3)]; print(x)
Write a python program to replace blank space to 1
print([i+j for i in "abc" for j in "def"])
Write a python program to multiply two list with list comprehensive
l1=[1,2,3]
l2=[4,5,6]
print([x*y for x in l1 for y in l2])
Write a python program to print only digit or only apha charac in a given list
l=["good", "oh!", "excellent!", "#450"]
print([n for n in l if n.isalpha() or n.isdigit()])
Write a python program to print todays date
tday=datetime.date.today()
print(tday)
Write a python program to check tuple are immutable
a=(1,2,3)
try:
a = a+1
except Exception as e:
print(e)
Write a python program to calculate factorial sum using list comprehensive
import functools
n =5
print(functools.reduce(lambda x, y: x * y, range(1, n+1)))