A
A
Anton2021-09-05 18:10:45
Python
Anton, 2021-09-05 18:10:45

How to put values ​​into a list on such a Python example?

Greetings!
Please tell me how to put values ​​in a list, for example, there is such a code:

for i in range(10):
    rand = SystemRandom().randrange(10000000,90000000)
    hex = "%010x" % rand
    print(hex)
The result of the execution will be 10 random values ​​of the type :
0003e43bdd
00046bae21
0004c251c6
000175db33
0004b265a6
0004181c8c
000392e492
000336b369
0004d5ce1c
000500163f

valueslit = ','.join(values)
print(valueslit)
And the result of execution separated by commas:
0003e43bdd, 00046bae21, 0004c251c6, 000175db33 and so on...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
UberPool, 2021-09-05
@boypush

hex_list = []
for i in range(10):
    rand = SystemRandom().randrange(10000000,90000000)
    hex = "%010x" % rand
    hex_list.append(hex)

result = ','.join(hex_list)
print(result)

6134e9aa1ea33772609907.png

V
Vindicar, 2021-09-05
@Vindicar

Read the documentation, or at least google it, huh? About the .append() method, which adds a value to the end of the list, is written in almost every first python tutorial.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question