I have a situation in which the same code gives an error in idle but works
in qtconsole
regards,
*in idle*
v = np.zeros(len(x))
for i in range(len(x)):
if x[i] < 1.0:
v[i] = 0
else:
v[i] = V
print v
======== RESTART: C:\Users\SHARMA\Documents\Python Scripts\sqwell.py
========
Traceback (most recent call last):
File "C:\Users\SHARMA\Documents\Python Scripts\sqwell.py", line 45, in
<module>
if x[i] < 1.0:
ValueError: The truth value of an array with more than one element is
ambiguous. Use a.any() or a.all()
*in qtconsole*
v = np.zeros(len(x))
for i in range(len(x)):
if x[i] < 1.0:
v[i] = 0
else:
v[i] = V
print v
[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 20. 20. 20. 20.
20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20.
20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20. 20.
20. 20. 20. 20. 20. 20. 20. 20. 20. 20.]
Sarma.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor