Write a NumPy program to create an array using scientific notation numbers. Set the precision value to 6 and print the array

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

Write a NumPy program to create an array using scientific notation numbers. Set the precision value to 6 and print the array.

الأجوبة

import numpy as np
nums = np.array([1.2e-7, 1.5e-6, 1.7e-5])
print("Original arrays:")
print(nums)
print("Set the precision value to 10:")
np.set_printoptions(suppress=True, precision=10)
print(nums)

Sample Output:

Original arrays:
[1.2e-07 1.5e-06 1.7e-05]
Set the precision value to 10:
[0.00000012 0.0000015  0.000017  ]
هل كان المحتوى مفيد؟

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

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