Use cases of Generators



a=[1,2,3]
b=[]
for i in a:
k=i*i
b.append(k)
print(b)
[1, 4, 9]
a=[1,2,3]
k=[i*i for i in a]
print(k)
[1, 4, 9]
n=[21,102,56,33,99,101,36,33]
k=[]
for i in n:
if i%2!=0:
k.append(i)
print(k)
[21, 33, 99, 101, 33]
n=[21,102,56,33,99,101,36,33]
k=[i for i in n if i%2!=0]
print(k)
[21, 33, 99, 101, 33]

Label Encoding and One Hot Encoding

Photo by Bailey Granneman on Unsplash



Photo by Luke Chesser on Unsplash

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store