num = [1,2,3,4] a = "RDD" for i in range(len(a)): if a[i] == "R": num = num[::-1] elif a[i] == "D": num.remove(num[0]) print(num)
To embed this project on your website, copy the following code and paste it into your website's HTML: