@_Nobody_/

Useful

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
def list_replace(lst, old, new, maximum):
    if len(lst) == 0 or maximum == 0:
        return lst
    elif lst[0] == old:
        return [new] + list_replace(lst[1:], old, new, maximum-1)
    else:
        return [lst[0]] + list_replace(lst[1:],old,new,maximum)

def getlines():
    a = input()
    if not a:
       return a
    else:
        return a + "\n" + getlines()