fork download
  1. import random
  2.  
  3. rand_nums = random.sample(range(400), 400) # produz 400 nums random em que cada tera um valor de 0 a 400
  4. pos = {} # declarar dicionario
  5. for idx, val in enumerate(rand_nums): # map do idx e valor
  6. if val < 100:
  7. pos[idx] = val
  8. print(pos)
Success #stdin #stdout 0s 33864KB
stdin
Standard input is empty
stdout
{5: 25, 8: 9, 10: 40, 13: 0, 15: 29, 16: 10, 18: 37, 22: 81, 24: 43, 26: 55, 28: 84, 39: 20, 49: 19, 58: 77, 59: 28, 65: 75, 68: 56, 71: 1, 76: 58, 79: 85, 86: 23, 91: 90, 94: 12, 97: 50, 101: 99, 107: 61, 108: 70, 110: 11, 112: 52, 123: 97, 125: 64, 128: 83, 131: 59, 132: 24, 137: 42, 144: 26, 147: 30, 148: 13, 149: 32, 158: 2, 161: 86, 162: 33, 163: 39, 175: 89, 179: 36, 180: 82, 191: 27, 194: 93, 200: 18, 211: 88, 212: 67, 220: 57, 221: 35, 223: 74, 228: 8, 229: 94, 231: 31, 237: 41, 238: 73, 240: 4, 248: 68, 249: 14, 253: 66, 255: 51, 259: 76, 262: 54, 264: 38, 267: 95, 269: 98, 272: 78, 277: 69, 281: 80, 287: 62, 290: 65, 293: 16, 303: 44, 306: 22, 307: 71, 308: 46, 309: 48, 310: 96, 312: 49, 315: 5, 316: 91, 318: 34, 319: 21, 323: 17, 354: 60, 356: 92, 357: 7, 360: 79, 365: 47, 370: 53, 373: 15, 374: 87, 382: 45, 387: 3, 390: 6, 391: 72, 398: 63}