Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
One Liner Using Pop and IF solution in Clear category for Replace First by Abrar_Ahmed
from typing import Iterable
def replace_first(items: list) -> Iterable:
#pop returns first value
#append adds it back at the end of list
#executed if length of list > 0
items.append(items.pop(0)) if len(items)>0 else None
return items
July 22, 2021
Comments: