“Penyesalan Python” Kode Jawaban

Penyesalan Python

#// required library
import numpy as npy

#// define 3 (1D) numpy arrays
arr1 = npy.array([10, 20, 30])
arr2 = npy.array([40, 50, 60])
arr3 = npy.array([70, 80, 90])

arrCon = npy.concatenate([arr1, arr2, arr3])
print(arrCon)

#// concatenation can also happen with 2D arrays
arr1_2d = npy.array([
  [10, 20, 30],
  [40, 50, 60]
])
arr2_2d = npy.array([
  [11, 22, 33],
  [44, 55, 66]
])

arr_2dCon = npy.concatenate([arr1_2d, arr2_2d])
print(arr_2dCon)
ST111

String gabungan di Python

# concatenating strings just means combining strings together
# it is used to add one string to the end of another
# below are two exmaples of how concatenation can be used 
# to output 'Hello World':

# example 1:
hello_world = "Hello" + " World"
print(hello_world)

>>> Hello World

# example 2:
hello = "Hello"
print(hello + " World")

>>> Hello World
codeconnoisseur

Python menggabungkan string

my_list = ['a', 'b', 'c', 'd']
my_string = ','.join(my_list)
# Output = 'a,b,c,d'
Quercia

gabungan dalam python 3

first_name = 'Albert'
last_name = 'Einstein'
full_name = first_name + ' ' + last_name
print(full_name)

# Output -
# Albert Einstein
Rajitha Amarasinghe

Jawaban yang mirip dengan “Penyesalan Python”

Pertanyaan yang mirip dengan “Penyesalan Python”

Lebih banyak jawaban terkait untuk “Penyesalan Python” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya