Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integer array in Python

Tags:

python

How I can define array of integer numbers in Python code

Say if this code is ok. or no

pos = [int]

len = 99

for i in range (0,99):
    pos[i]=7
like image 917
Ra'ed Avatar asked Nov 29 '22 19:11

Ra'ed


1 Answers

Why not just:

pos = [7] * 99

This is the most pythonic, in my opinion.

like image 153
carl Avatar answered Dec 05 '22 14:12

carl