“Peta Python 3” Kode Jawaban

Peta dalam Python

# Python program to demonstrate working 
# of map. 
  
# Return double of n 
def addition(n): 
    return n + n 
  
# We double all numbers using map() 
numbers = (1, 2, 3, 4) 
result = map(addition, numbers) 
print(list(result))
# result [2, 4, 6, 8]
Grumpy Gull

Peta Python 3

from multiprocessing import Pool

def test( v ):
    print(v)
    return v

if __name__ == '__main__':
    with Pool(2) as p:
        print(p.map(test, range(5)))
Xerothermic Xenomorph

Jawaban yang mirip dengan “Peta Python 3”

Pertanyaan yang mirip dengan “Peta Python 3”

Lebih banyak jawaban terkait untuk “Peta Python 3” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya