In this video, Jennifer Harrison discusses the nuances of working with numeric values in Python. Learn what to watch out for when doing math with numeric values.
- [Instructor] Numeric variables…hold whole numbers, integers,…and floating point numbers…which are numbers with decimal places.…Numeric values are used to hold things…like the number of features in a feature class,…the size of a file, or the longitude coordinate…for a point location.…In Python, numbers don't get quotes around them.…I'm in the Python Idle window…to demonstrate a few examples…of working with numeric values in Python.…
It's important to always be aware…of what type of value is being used.…I'm going to show you two similar print statements…that will result in very different values…because of the data types being used.…Suppose I set a variable called numAdultCats equals two…and numKittens equals five.…So I print…my cat just had kittens.…So now, I have…numAdultCats…plus numKittens cats.…
So that works just fine.…I now have seven cats,…but if the variables had been created…just a little differently…by putting quotes around the numbers like this,…numAdultCats equals two,…numKittchens equals five,…and I do exactly the same print statement.…
- Writing and running Python scripts in IDLE
- Making scripts flexible with variables
- Commenting scripts
- Manipulating string data
- Object-oriented programming in Python
- Creating loops
- Reading and writing text files
- Capturing input at runtime
- Documenting your scripts
Skill Level Beginner
1. Python for ArcGIS Basics
2. Strings, Numbers, and Variables
Work with numeric values5m 22s
3. Syntax Rules
4. Manipulating Strings
5. Object-Oriented Programming
6. Using Loops
7. Generate Log Files
8. Input at Run Time
9. Help Documents
Documenting a script1m 59s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.