Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PyGen
#python 3.6.9 #PyGen: example of Python generator #this code is created by Rezaul Hoque on April 25,2022. #contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com #note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; def start(): print("Python generator example") yield '#'*25 print("April 25,2022") yield '*'*25 def cel2far(ar): for k in ar: yield 9*k/5+32 def cel2kel(ar): for k in ar: yield k+273.15 temp=[10,20,15,35,40] theList=cel2far(temp) theList2=cel2kel(temp) m=start() display=next(m) print(display) display=next(m) print(display) print("Temperature in Celsius: ") for s in temp: print(s) print("Temperature in Fahrenheit:") for s in theList: print(s) print("Temperature in Kelvin: ") for s in theList2: print(s)
run
|
edit
|
history
|
help
0
>= Number regex generator
T
Patterns
31 dec
square cube
Reading XML file
Python Monthly Calendar
Omirp
Ej2_python_204676887
Alphabet