使用while语句去解决约瑟夫环问题
人数为39人
list1=[i for i in range(1,40)]
list1
``[1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39]
while len(list1)>2:
pop1=list1.pop(0)
pop2=list1.pop(0)
list1.remove(list1[0])
list1.append(pop1)
list1.append(pop2)
list1
[10, 25]