0
Why it is showing nothing when I print L in it
What L is empty But if i put L in inside loop it is executing https://code.sololearn.com/c3mjRgul7WsJ/?ref=app
7 Antworten
0
import random
l=[]
while len(l)<4:
x=random.randrange(5)
y=random.randrange(5)
if x+y==5:
if [x,y] not in l:
l.append([x,y])
print(l)
+ 1
It is not empty, there is no output because your code is inside an infinite loop so it will not reach the line with print(l) because it will stay in the loop
+ 1
I need last line of :
[[1,4],[3,2],[ 2,3],[4,1]] order is not important
+ 1
Thanks
0
What should i do
0
To get desired output
0
What is the desired output that you need?