“Loop Foreach di Python” Kode Jawaban

untuk setiap loop python 3

# 'foreach' in python is done using 'for'
for val in array:
    print(val)
QuietHumility

py foreach

// PHP:
foreach ($array as $val) {
    print($val);
}

// C#
foreach (String val in array) {
    console.writeline(val);
}

// Python
for val in array:
    print(val)
Crazy Copperhead

py foreach

names = ['tom', 'john', 'simon']

namesCapitalized = [capitalize(n) for n in names]
Crazy Copperhead

Loop Foreach di Python

# Python doesn't have a foreach statement per se. 
# It has for loops built into the language. 
# As a side note the for element in iterable syntax comes from 
# the ABC programming language, one of Python's influences
mrhm.dev

Jawaban yang mirip dengan “Loop Foreach di Python”

Pertanyaan yang mirip dengan “Loop Foreach di Python”

Lebih banyak jawaban terkait untuk “Loop Foreach di Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya