# theres a lot of ways to concatenate in python
# here are all examples that i know:
world = 'World!'
number = '69'
a = 'Hello ' + ' ' + world + ' ' + number
b = 'Hello {} {}'.format(world, number)
c = f'Hello {world} {number}' # most easy / beginner friendly
d = 'Hello %s %s', % (world, number)
e = 'Hello', world, number
# all of these will print "Hello World! 69"
print(a)
print(b)
print(c)
print(d)
print(e)
#// 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)
#How to concatenate in python with f strings
# This is the best way I have seen to concatenate a string with and integer
a = 'aaa'
b = 'bbb'
c = 'ccc'
d = 12
txt = f'{a}{b}{c}{d}'
print(txt)
It will print:
aaabbbccc12
#It works as long as you have python 3.6.0 or up!
# I am jsut glad it works
#if you have a mac computer with vs code on it edit the .json file and change python to python 3 if you have python 3 already installed!