• Complain

Craig - Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator

Here you can read online Craig - Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2021, publisher: Books To Believe In, genre: Home and family. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

No cover
  • Book:
    Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator
  • Author:
  • Publisher:
    Books To Believe In
  • Genre:
  • Year:
    2021
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Craig: author's other books


Who wrote Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator? Find out the surname, the name of the author of the book and a list of all author's works by series.

Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Python for the TI-Nspire
Powerful Python programs and games for the TI-Nspire CX II technology calculator
by
John Clark Craig
Introduction

Why Python?

Python, the world's most popular programming language, is an ideal language for handheld calculators. The syntax is concise, easy to read, and easy to understand, even for beginners. The language is non-proprietary, so it runs everywhere, even on desktop and laptop computers with only minor modifications from what you'll find in this book, and even then only in a very few cases.

Python handles number crunching well, and with its lists, strings, and other data structures, it powerfully handles a very wide variety of programming tasks. But perhaps the biggest advantage of learning Python via your programmable calculator is that this knowledge will be applicable and useful no matter what computers or systems you might work with in the future. Learn it once and you'll have a new life skill of great value.

Python in your calculator

Most of the number crunching that takes place in Python programs is straightforward and easy to understand. When it comes to interacting with the user to request input and output (commonly referred to as I/O) there are some optional approaches, and understanding some of these make it easier for you to make shorter programs, or longer but more user friendly programs, depending on your style and programming goals. The programs in this book use several of these approaches, and it's important to know that you can change these programs if you prefer one type of programming over another.

An excellent way to leverage Python in your calculator is to simply define functions in a "program" file. When you run the program, nothing visibly happens. But the function definitions are effectively added to your calulator's toolbox, ready for your use while working in the shell. For example, here's the contents of a very short program that defines a function named add().

def add(x,y):
return x+y

After you run this program, in the shell you can type something like "add(3,4)" to get 7, or to add any two numbers or variables together. More complicated functions can add some powerful new capabilities to your computation toolbox!

Many of the programs in this book were created as sets of function definitions in this way. This keeps the programs very short and easier to enter. In some cases, the programs also printed some instructions and reminders on how to use the functions, for easy reference. Take a look at the vectors program near the end of chapter 6 for a good example of how to add helpful instructions, while just defining functions for later use in the shell.

The standard way to create standalone programs in most programming languages is to prompt the user for input data, and then to process that data in a meaningful way to create output for the user. Throughout this book there are several programs where you are asked to type data in response to a prompt at run time, and then the calculations begin. Take a look at the primes program, also in chapter 6, for an example where the program asks you to enter the starting point to look for primes, and the number of those primes to find.

There are a few other useful I/O tricks presented in several of the programs in this book. It is sometimes useful to ask for a number, but to let the user simply press [enter] without entering a number if they don't know the value. This is actually a tricky thing to do, as a simple assignment to a variable after an input() function call can fail of nothing is input. Take a close look at the program arc_parts, in chapter 8 for an example where any combination of two of four variables can be entered, and the missing ones will be calculated. Here's a pair of code lines where an angle is entered, or a value of zero is put in place if the user simply presses [enter].

a=input("Angle (deg): ")
a=float(a) if a else 0

Learn by Examples

There are many, many resources online and in other books to learn the intricacies of the Python language. The goal of this book isn't to duplicate all this information. Instead, there's a lot of short, useful programs that you can use "right out of the box", and in putting them to use you'll learn a lot about Python indirectly.

If you are looking for an absolute beginner's tutorial to help you get up to speed with programming in Python on your TI-Nspire CX II technology calculator, there's an excellent web site by Texas Instruments titled "10 Minutes of Code: Python". I recommend taking a look at these skill building lessons. Here is the link:

https://education.ti.com/en/activities/ti-codes/python

Whenever you find a command that looks a little mysterious, I strongly suggest you Google it for more information. In my opinion, this is a better way to learn a lot of Python programming techniques, by using and experiencing the commands in action.

For example, it took me awhile to stumble upon Python's useful zip() function. I used it several places in the vectors program to create extremely concise and powerful vector functions. Go Google on "Python zip", learn how it works, and then you'll gain a really good understanding of how the vector add() function works for 2d, 3d, or even bigger vectors.

Your TI-Nspire CX II technology calculator is a very powerful learning tool, and with the addition of Python, its mind-expanding capabilites are truly awesome!

1.
Dates and Times

How old are you today? Next time someone asks you this question, you can answer with the exact number of days rather than just rounding off to the number of years. Then, to impress them even more, be sure to casually mention the day of the week you were born.

These are the types of questions the programs in this chapter will let you answer with ease.

calendar

This program creates a nice one-month, single-page calendar for any month over a several-century period of time.

At the heart of this program is a function that returns the Julian Day Number for any date in the range of years from 1582 to 4000. This function, named jd(), is explained in more detail later in this chapter, but here it is used to determine the number of days in any given month, and the day of the week for any date. From this information we can format all the days in a given month into an easy-to-read one-month calendar.

Wilbur and Orville Wright's first heavier than air flight took place on the morning of December 17, 1903, at Kitty Hawk, North Carolina. We can run this program to see the full one-month layout of December, 1903 and easily determine that the 17th was a Thursday.

from tidraw import def jdmdy if mlt3 y-1 m12 - photo 1

from ti_draw import *
def jd(m,d,y):
if m<3:
y-=1
m+=12
a=int(y/100)
b=2-a+int(a/4)
e=int(365.25*(y+4716))
f=int(30.6001*(m+1))
return b+d+e+f-1524.5
# Get month and year
m=int(input("Month (1-12): "))
y=int(input("Year (1582-4000): "))
d1=int(jd(m,1,y))
dw=(d1+2)%7
m2=m+1 if m<12 else 1
y2=y if m<12 else y+1
d2=int(jd(m2,1,y2))
dm=d2-d1
mo=["Jan","Feb","Mar","Apr","May","Jun",
"Jul","Aug","Sep","Oct","Nov","Dec"]
# Set spacing
lt,tp,rs,cs=35,40,20,35
# Month, Year caption
s="{} {}".format(mo[m-1],y)

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator»

Look at similar books to Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator»

Discussion, reviews of the book Python for the Nspire: Powerful Python programs and games for the TI-Nspire (tm) CX II technology calculator and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.