Question: I asked a similar question before but it was worded badly. I figured some stuff out but not yet successful. I'm trying to create a new 2D array by calling a previous function. I want function\_2 to do the same calculation as function\_1 except in function\_2 it's involving arrays rather than single values.

This is what I have:

```
import numpy as np 

def function_1(A,B):
    A = 10
    B = 2
    ans = A*B
    return ans

def function_2(C,D):

    C = np.array([1,2,3,4,5])
    D = np.array([1,2,3,4,5])

    #here I create a zero array and include some other codes required

    for i in range(C): #each i are A values
        for j in range(D): #each j are B values
            array[i,j] = function_1(C,D)

    return array
print(array)

```

The above example gives me this:

```
[[25. 25. 25. 25. 25.]
 [25. 25. 25. 25. 25.]
 [25. 25. 25. 25. 25.]
 [25. 25. 25. 25. 25.]
 [25. 25. 25. 25. 25.]]

```

But I want it to take every value of C and D to do calculations and give me something like this:

```
[[1. 2. 3. 4. 5.]
 [2. 4. 6. 8. 10.]
 [3. 6. 9. 12. 15.]
 [4. 8. 12. 16. 20.]
 [5. 10. 15. 20. 25.]]

```

Thanks

Answer: 
Access the hour field using `current_time.hour` which returns an`int` which implies that it should not be compared with `str`.

You can do therefore:

```
import datetime
current_time = datetime.datetime.now().time()

if 22<= current_time.hour <=23:
    print ("current time is between 10:00pm to 11:00pm")
else:
    print ("current time is NOT between 10:00pm to 11:00pm")

```
You can use the fact that Python lets you do arithmetic and comparisons with `datetime` objects.
You appear only to be concerned about hours and minutes, so just get these from the current time to create a `datetime.time` object, and compare these with similar objects denoting 22:00h and 23:00h.

```
import datetime
current_time = datetime.datetime.now()
now = datetime.time(current_time.hour, current_time.minute)
if datetime.time(22, 0) <= now <= datetime.time(23, 0):
    print "current time is between 10:00pm to 11:00pm":
else:
    print "current time is NOT between 10:00pm to 11:00pm"

```