Array merging
In some situations, you might have multiple arrays and want to combine them together into one large array.
In this example, we have two arrays of stock tickers, stocks_yesterday and stocks_today. The first array contains stock tickers we traded yesterday, and the second array contains stock tickers that we traded today. We want to create a master array, with all tickers combined.
Remember that to merge two arrays, we use the semicolon operator ;, just as we do when creating a multi-dimensional array.
Bài tập này là một phần của khóa học
Intermediate Julia
Hướng dẫn bài tập
- Merge
stocks_yesterdayandstocks_todayand store the result instocks_master.
Bài tập tương tác thực hành trực tiếp
Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.
# Create the arrays stocks_yesterday and stocks_today
stocks_yesterday = ["AAPL" "MSFT";"TSLA" "MSFT"]
stocks_today = ["V" "AAPL";"GOOG" "AMZN"]
# Concatenate the stocks_yesterday and stocks_today arrays
stocks_master = ____