Using values from lists and spreadsheets in python

8 views
Skip to first unread message

Jody Crothers

unread,
May 9, 2024, 10:47:58 PMMay 9
to TI-Innovator
Hi Everyone
I want to plot a drawing using sets of points in a spreadsheet page using python. eg draw line from xval[1],yval[1] to xval[2],yval[2]

Jody Crothers


Head of Learning Area (Mathematics)

Ridge View Secondary College

Western Australia

www.jodstar.com

Chhaya, Harshal S.

unread,
May 9, 2024, 11:13:12 PMMay 9
to ti-inn...@googlegroups.com

> I want to plot a drawing using sets of points in a spreadsheet page using python. eg draw line from xval[1],yval[1] to xval[2],yval[2]

 

Hi Jody,

 

If you already have the points in two lists, you can use the “recall_list()” function from the ti_system module to pull in the lists into your Python program.

 

Then to draw the lists, you can two options:

  1. draw_poly(xl,yl)
  2. Use a “for” loop to iterate through the lists and use: draw_line(xl[i],yl[i],xl[i+1],yl[i+1]).

With this method, you will have to be careful about your range() for the ‘for’ loop – it will need to end at len(array) - 1

 

The attached TNS file has two lists and a Python program that shows both options.

If you run the program as-is, it will plot in black, wait for you to press a key and then plot the same graph using the 2nd method in red.

 

Hope this makes sense.

 

Please let me know if you have any questions or comments.

 

Regards,

- Harshal

 

lsplot.tns

Jody Crothers

unread,
May 9, 2024, 11:54:18 PMMay 9
to ti-inn...@googlegroups.com
Thanks Harshal

recall_list that was the command I was looking for

Jody Crothers


Head of Learning Area (Mathematics)

Ridge View Secondary College

Western Australia

www.jodstar.com


From: 'Chhaya, Harshal S.' via TI-Innovator for Education <ti-inn...@googlegroups.com>
Sent: Friday, 10 May 2024 11:13 AM
To: ti-inn...@googlegroups.com <ti-inn...@googlegroups.com>
Subject: RE: Using values from lists and spreadsheets in python
 
--
You received this message because you are subscribed to the Google Groups "TI-Innovator for Education" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ti-innovator...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ti-innovator/bbc9113cdcc54dd6b76df1012cd047d2%40ti.com.

Jody Crothers

unread,
May 10, 2024, 12:33:52 AMMay 10
to ti-inn...@googlegroups.com
Yay it worked
even added a sleep command to watch it draw
Now I can call for help
with my python Bat signal


Jody Crothers


Head of Learning Area (Mathematics)

Ridge View Secondary College

Western Australia

www.jodstar.com


From: ti-inn...@googlegroups.com <ti-inn...@googlegroups.com> on behalf of Jody Crothers <jodst...@hotmail.com>
Sent: Friday, 10 May 2024 11:54 AM
To: ti-inn...@googlegroups.com <ti-inn...@googlegroups.com>
Subject: Re: Using values from lists and spreadsheets in python
 

HMH

unread,
May 11, 2024, 11:20:30 AMMay 11
to TI-Innovator for Education
Dear folks,

... and here is some simple Python code that controls TI-Rover movements from a x,y list in a lists&spreadsheet window.

Enjoy,
Hans-Martin


roverslalom.tns
Reply all
Reply to author
Forward
0 new messages