I tried splitting each value up into two values and appending average of each two values into an array and casted to integers. its giving me an error. Here is code:
Error I am getting:
This is for exercise 2 of Day 20 of the 30 Days of Python course:
https://github.com/Asabeneh/30-Days-Of-P...manager.md
Code
import numpy as np
cats_api = requests.get('https://api.thecatapi.com/v1/breeds')
cats = cats_api.json()
weight_list = np.array([])
for cat in cats:
num = cat["weight"]["metric"]
first_num = int(num.split("-")[0])
second_num = int(num.split("-")[1])
value = int((first_num + second_num)/2)
print(value)
np.concatenate(weight_list, value)
print(weight_list)Error I am getting:
Code
greg@greg-IdeaPad-5-15ARE05:~$ /bin/python3 "/home/greg/Documents/Python/Day 20.py"
4
Traceback (most recent call last):
File "/home/greg/Documents/Python/Day 20.py", line 26, in <module>
np.concatenate(weight_list, value)
File "<__array_function__ internals>", line 200, in concatenate
ValueError: need at least one array to concatenateThis is for exercise 2 of Day 20 of the 30 Days of Python course:
https://github.com/Asabeneh/30-Days-Of-P...manager.md


