fork download
  1. import random
  2.  
  3. def sum_digits(x):
  4. res = 0
  5.  
  6. while x:
  7. res += x % 10
  8. x //= 10
  9.  
  10. return res
  11.  
  12. def gen_smth(N):
  13. digit = random.randint(1, 9)
  14. mid = random.randint(0, 10**N - 1)
  15. if sum_digits(mid) % 2: mid -= 1
  16. return (digit * 10**N + mid) * 10 + digit
  17.  
  18. for _ in range(100):
  19. print(gen_smth(3))
Success #stdin #stdout 0.04s 11904KB
stdin
Standard input is empty
stdout
61496
72867
18731
56115
53545
33303
74087
17471
88228
59145
18261
98089
49904
27562
44734
92089
43014
26622
68996
20082
16061
72577
85238
71167
19451
19961
93659
27102
19011
83638
88668
28512
10991
95949
22692
52465
44534
88378
81278
45234
47724
18601
95369
38863
63106
41304
28372
91479
97399
89238
93989
46994
45614
36023
21142
11181
29872
31943
56265
47964
28282
21252
38373
54715
39293
18221
21292
40464
23472
50485
14151
30933
80778
52535
47524
19761
55635
64686
14291
29872
69216
88138
10711
72757
92089
21652
24682
28862
12241
61436
18201
63796
79187
82358
99479
11271
67236
87478
39723
15651