Write a NumPy program to convert a given list into an array, then again convert it into a list. Check initial list and final list are equal or not

  • برمجة بايثون

Write a NumPy program to convert a given list into an array, then again convert it into a list. Check initial list and final list are equal or not

الأجوبة

import numpy as np
a = [[1, 2], [3, 4]]
x = np.array(a)
a2 = x.tolist()
print(a == a2)

Sample Output:

True
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...