import random All_path=[] Pos=[0,0] Path=[[0,0]] n=0 while n<1: n+=1 while Pos!=(20, 20): if Pos[1]==20: Pos[0]+=1 elif Pos[0]==20: Pos[1]+=1 else: c=randint(0,1) Pos[c]+=1 Path.append(Pos) if Path not in All_path: All_path.append(Path) print All_path
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question