简体   繁体   English

我如何打印元素类型为 float 的反向 NumPy 数组

[英]How can i print a reversed NumPy array with the element type float

import numpy

def arrays(arr):
    # complete this function
    # use numpy.array

arr = input().strip().split(' ')
result = arrays(arr)
print(result)
import numpy as np
a=np.array([0,1,2,5,6],float)
print a

I think this is what you are looking for:我想这就是你要找的:

import numpy as np
arr = input().strip().split(' ')
def arrays(arr):
    arr = np.array(arr, dtype=float)
    return(arr[::-1]) # this will reverse the array
arrays(arr)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM