# HP Forums

Full Version: Where's the Error?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to run the following program on my Prime (both emulator and physical) and it gives me a syntax error in line 9. I've been looking at it and looking at it and I can't see the error. What am I doing wrong?

Code:
```#PYTHON name from math import * t=eval("ticks()") loops=1000 for i in range(0,loops):   r0=10   while True:     x=r0      x+=1     x-=4.567ᴇ−4     x+=70     x-=69     x*=7     x/=11     r0-=1     if r0<=0:       break   x=log(x)   x=sin(x)   x=sqrt(x)   x=sqrt(x) print(x) t=(eval("ticks()")-t)/1000 print("Index:",34/t*loops)  #end    EXPORT calcperf() BEGIN   PYTHON(name); END;```
With a few changes your program runs and returns:

0.880981899968678
Index: 1172413.79310345

The changes I made:
1. add 'from hpprime import *' at the beginning
2. replace the 'ᴇ−' on line 9 by standard 'E-' letters, it seems that the special character codes used by the Prime for E and minus signs are not supported by Python.

Code:
```#PYTHON name from math import * from hpprime import * t=eval("ticks()") loops=1000 for i in range(0,loops):   r0=10   while True:     x=r0      x+=1     x-=4.567E-4     x+=70     x-=69     x*=7     x/=11     r0-=1     if r0<=0:       break   x=log(x)   x=sin(x)   x=sqrt(x)   x=sqrt(x) print(x) t=(eval("ticks()")-t)/1000 print("Index:",34/t*loops)  #end  EXPORT calcperf() BEGIN   PYTHON(name); END;```
(08-30-2021 03:36 PM)Didier Lachieze Wrote: [ -> ]With a few changes your program runs and returns:

0.880981899968678
Index: 1172413.79310345

The changes I made:
1. add 'from hpprime import *' at the beginning
2. replace the 'ᴇ−' on line 9 by standard 'E-' letters, it seems that the special character codes used by the Prime for E and minus signs are not supported by Python.

Thank you!
Now that you've solved it. I have to say of course! I should have known the ticks function is found in the hpprime module but the exponent error is more subtle. It makes sense, though.
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :