Skip to content

Instantly share code, notes, and snippets.

@BetterProgramming
Created September 14, 2020 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BetterProgramming/fe4a208e7b1ce2ec26255bcb3ace0837 to your computer and use it in GitHub Desktop.
Save BetterProgramming/fe4a208e7b1ce2ec26255bcb3ace0837 to your computer and use it in GitHub Desktop.
def square(x):
return x*x
num=[1,2,3,4,5]
s=map(square,num)
print (next(s))
print (next(s))
print (next(s))
print (next(s))
print (next(s))
#Output:
'''
1
4
9
16
25
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment