ThinkPython is a free Python book. Its first chapter is about programming in general. Read it here..
Read the glossary also, but don't study it too much. Some things in it are useful to know, but I think studying it carefully would be really boring. Also do all exercises except the last one. It's more about math skills than learning Python.
When you're done reading, read the summary below and make sure you've learned everything.
- Now you should have some kind of idea about what programming is.
- Each value has a type, and you can find that out with
type(value)
. For example, writingtype(123)
to the Python prompt does the same thing as writingint
to the prompt. - Types and classes are the same thing (in Python 3).
- Some of the most commonly used types are:
- int is short for integer.
1
and2
are integers. - float is short for floating point number.
1.0
and3.14
are floats. - str is short for string.
"hello"
and'hello'
are strings. It doesn't matter if you use 'single quotes' or "double quotes", they do the same thing in Python.
- int is short for integer.
- What happens if you use + between two strings, like
"hello" + "world"
? How about"hello" * "world"
? - What happens if you use + between a string and an integer, like
"hello" + 3
? How about"hello" * 3
? - What happens if you use + between a float and an integer, like
0.5 + 3
? How about0.5 * 3
?
If you have trouble with this tutorial please tell me about it and I'll make this tutorial better. If you like this tutorial, please give it a star.
You may use this tutorial freely at your own risk. See LICENSE.