Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python Generators with a Loop

def rev_str(my_str):
    length = len(my_str)
    for i in range(length - 1, -1, -1):
        yield my_str[i]


# For loop to reverse the string
for char in rev_str("hello"):
    print(char)
Comment

PREVIOUS NEXT
Code Example
Python :: python Sum of all the factors of a number 
Python :: remove element from list python by value 
Python :: Tree: Postorder Traversal 
Python :: dict comprehension python 
Python :: Lucky four codechef solution 
Python :: conda create new env 
Python :: pip install 
Python :: python vector class 
Python :: flask windows auto reload 
Python :: insert an element in list python 
Python :: Python NumPy insert Function Syntax 
Python :: reshape IML matrix 
Python :: how to make a 2d array in python 
Python :: create QAction with icon in pyqt 
Python :: image hashing 
Python :: <pandas.core.groupby.generic.dataframegroupby object 
Python :: remove watermark using python 
Python :: how to declare a lambda in python 
Python :: splitting strings in python 
Python :: Python Dynamic Create var 
Python :: two underscores python 
Python :: python xmlrpc 
Python :: seaborn stripplot min max 
Python :: crypto trading bot python 
Python :: boto 3 list EMR 
Python :: init array in numpy 
Python :: Use len with list 
Python :: pivot table but keep nan 
Python :: python - convert a list column into miltiple columns 
Python :: handling timezone in python 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =