Skip to content

Latest commit

 

History

History
50 lines (39 loc) · 1.95 KB

the-way-of-the-program.md

File metadata and controls

50 lines (39 loc) · 1.95 KB

ThinkPython: The way of the program

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.

Summary

  • 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, writing type(123) to the Python prompt does the same thing as writing int 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 and 2 are integers.
    • float is short for floating point number. 1.0 and 3.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.

More exercises

  1. What happens if you use + between two strings, like "hello" + "world"? How about "hello" * "world"?
  2. What happens if you use + between a string and an integer, like "hello" + 3? How about "hello" * 3?
  3. What happens if you use + between a float and an integer, like 0.5 + 3? How about 0.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.

Previous | Next | List of contents