What The Heck is Dynamic Typing
A free video tutorial from Colt Steele
Developer and Bootcamp Instructor
4.7 instructor rating • 9 courses • 946,956 students
Learn more from the full courseThe Modern Python 3 Bootcamp
A Unique Interactive Python Experience With Nearly 200 Exercises and Quizzes
29:43:09 of on-demand video • Updated December 2020
- Learn all the coding fundamentals in Python!
- Work through nearly 200 exercises and quizzes!
- Learn about all of the latest features in Python 3.6
- Use Python to create an automated web crawler and scraper
- Make complex HTTP requests to APIs using Python
- Master the quirks of Python style and conventions
- Really Really Understand Object Oriented programming in Python
- Learn testing and TDD (Test Driven Development) with Python
- Write your own Decorators and higher order functions
- Write your own Generators and other Iterators
- Confidently work with Lambdas!
- Master tricky topics like Multiple Inheritance and Polymorphism
- Build games with Python
- Build larger projects that span across multiple files
- Work with all the Python data structures: lists, dictionaries, sets, tuples, and more!
- Become an expert at list and dictionary comprehensions
- Master built-in python functions like zip and filter
- Handle errors and debug code
- Write your own custom modules
- Work with files, including CSV
English [Auto] All right one last thing before strings I want to talk about dynamic typing. So Python is a language that is really really flexible about how we define our variables and it gives us the ability to reassign our variables not just from you know nine down to 98 but we could go from 9 9 to the string none or zero in quotes the word zero. So basically it allows us to have variables change types not just values from a number to a number or string to a string but the actual type. So for example we could have awesomeness set to what is this again. Boolean capital-T True. And I could print awesomeness and it's the pulley and troop. But then I could change it the same variable awesomeness not a different variable and set it to a string. A dog or I could set it to something called none which we haven't talked about yet but none is another value. Notice has a capital and so it's not a string. It's the way that Python represents the concept of nothing. So it's different than zero. That literally means nothing. We'll talk more about it when when we get to that point then we have Asinus equals 22 divided by seven. And the result of that is a float. So this is just something that it's good to be aware of. But this is also something that is somewhat unique to Python. So there are other languages that support dynamic typing as well but there are lots of languages that don't. So for example languages like C++ are what's known as statically typed which means when you define a variable as a boolean it has to stay as a boolean. And if you want to change it well you actually need to make a brand new variable and you can't really dynamically change it at all. So as an example of what that could look like. Take a look at this code. We have a variable called not awesomeness. We're setting equal to the number five. But we actually have to say ahead of time. This is an integer it's always an integer. And in C++ also notice the semi-colons. It's going to always expect it to be an integer. So we could change it. We could change it to seven or 20 year one million. But if we tried to change it to a string like cool it would throw an error and break our code. So that's it for this video. I just wanted you to be aware of the fact that Python is dynamically typed. You could change data types of variables at any point unlike other languages like C++ where you have to define a data type from the beginning and that variable always stays that way. All right. Now on to strings.