Help With Python?
|
07-17-2024, 05:38 PM
(This post was last modified: 07-17-2024 05:40 PM by toml_12953.)
Post: #1
|
|||
|
|||
Help With Python?
I'm trying to convert the following ANSI BASIC program to Python. The BASIC program works but the Python program gets a bad index error after some time. I've looked at it and looked at it but I can't discover what's causing the problem. Can anyone help?
BASIC Program: Code: 100 LET T0=TIME Python Program: Code: from time import * Tom L Cui bono? |
|||
07-17-2024, 05:52 PM
(This post was last modified: 07-17-2024 05:52 PM by ldesnogu.)
Post: #2
|
|||
|
|||
RE: Help With Python?
I’m not very familiar with Python but I guess list has 30000 elements indexed from 0 to 29999. So either you should dimension it to Y+1 or make comparisons <Y rather than <=Y.
Just guessing |
|||
07-17-2024, 07:07 PM
Post: #3
|
|||
|
|||
RE: Help With Python?
Another alternative to ldesnogu approach is to use an AI to convert the code.
This gives this which seem to work. At least it runs without an error. Code:
|
|||
07-18-2024, 03:30 AM
Post: #4
|
|||
|
|||
RE: Help With Python?
(07-17-2024 05:52 PM)ldesnogu Wrote: I’m not very familiar with Python but I guess list has 30000 elements indexed from 0 to 29999. So either you should dimension it to Y+1 or make comparisons <Y rather than <=Y. Quite right! Thanks! Tom L Cui bono? |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)