Skip to content

Commit ea80ebb

Browse files
committed
Add miscellaneous examples
1 parent 6f9f6e9 commit ea80ebb

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

examples/misc.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from tivars import *
2+
3+
4+
# Detokenize a program
5+
my_program = TIProgram.open("EXAMPLE.8xp")
6+
code = my_program.string()
7+
8+
9+
# Unprotect a program
10+
my_program = TIProtectedProgram.open("EXAMPLE.8xp")
11+
my_program.unprotect()
12+
13+
14+
# Turn a real number into a float
15+
my_real = TIReal.open("EXAMPLE.8xn")
16+
value = my_real.float()
17+
18+
19+
# Put real numbers into a list
20+
my_reals = TIReal(1), TIReal(2), TIReal(3)
21+
lst = TIRealList(my_reals)
22+
23+
24+
# Ungroup a group
25+
my_group = TIGroup.open("EXAMPLE.8xg")
26+
entries = my_group.ungroup()
27+
28+
29+
# Put inaccessible tokens into a string
30+
my_string = TIString("αβγ")
31+
32+
33+
# Convert an exact number into a real number
34+
my_exact = TIRealRadical.open("EXAMPLE.8xn")
35+
real = TIReal(my_exact.float())

0 commit comments

Comments
 (0)