פייתון/פייתון גרסה 3/לולאת for: הבדלים בין גרסאות בדף
תוכן שנמחק תוכן שנוסף
Mathreturn (שיחה | תרומות) |
Mathreturn (שיחה | תרומות) |
||
שורה 7:
</source>
* name הוא
<source lang = "python">
str_L=['1','2','3']
int_L=[]
# convent str in str_L to int
for i in str_L :
int_L.append(int(i))
print(int_L)
#what type of the items in the list?
for i in int_L:
print(type(i))
[1, 2, 3]
<class 'int'>
<class 'int'>
<class 'int'>
</source>
* lst היא רשימה
* action הפעולה שתבוצע.
|