SHARE
TWEET

Untitled

a guest Jun 19th, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def generator(): # generator which generates like 2,4,8,16 -> 2 to the power of x
  2.     list = range(1,65)
  3.     for i in list:
  4.         yield 2**i
  5.  
  6. mygen = generator() # generator object
  7.  
  8. expo = [] # empty list for the exponential values
  9.  
  10. for i in mygen: # for loop to put the values of the genertor in list form
  11.     expo.append(i)
  12.     print(expo)
  13.  
  14. for i in expo: # attempt to delete the last element, but stops at list with length 32
  15.     del expo[-1]
  16.     print(expo)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top