Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
50 lines (39 loc) · 1.95 KB

File metadata and controls

50 lines (39 loc) · 1.95 KB
Copy raw file
Download raw file
Outline
Edit and raw actions

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.