Find your next favorite book

Become a member today and read free for 30 days
Python. Easy Steps to Learning.

Python. Easy Steps to Learning.

Read preview

Python. Easy Steps to Learning.

Length:
75 pages
33 minutes
Released:
Mar 20, 2019
ISBN:
9780463902417
Format:
Book

Description

Basic programming using Python.
Included is input, process and output. The book also include basic programming principles such as sequencing, iteration and selection.

Released:
Mar 20, 2019
ISBN:
9780463902417
Format:
Book

About the author

I am a teacher at a public school in South Africa. My interests include programming (Python, HTML, CSS, Javascript, Delphi, Java) and gardening.


Related to Python. Easy Steps to Learning.

Related Books
Related Articles

Book Preview

Python. Easy Steps to Learning. - Renier Engelbrecht

Introduction

Python is simple language to understand as most of the commands are plain English. In this chapter, you are going to use Python to create simple scripts, in the interactive interpreter. An interpreted language is where the interpreter runs command for command, as opposed to a compiler language that takes all the code, compiles to byte code/executable and then runs the program. Therefore, Python can have an interactive compiler, as Python is an interpreted language. The user enters a command in the interactive interpreter, and the command is executed. In this series the focus is on Python 3.7. There are two major versions of Python. The first is 2.7 and then there is 3.7. The difference is that 3.7 is the newest version that is to a major extend incompatible with code from 2.7. To maintain continuity and let developers make a transition to version 3, the older version is still supported. To use the newest version is better, as this contains all the new syntax and other enhancements.

The interactive Python Shell, as the screenshot above is called, is mainly used for short interactive sessions where the user wants to write short amount of code, to test, debug (clear errors), or write specific procedures. In this chapter we focus on this interactive session. As soon as the Python IDLE Shell is closed, all data entered will be erased! Start Python IDLE.

The shortest program that one can write is where the interpreter greets a person. For example; Hi there Sally! To do this, the user writes this in a print statement.

Output

Hi there Sally! Hi there Sally!

The user entered a print statement. Take note of the following: all lower case the word print; and whatever the user wants to displayed is between round brackets and single/double inverted commas. The user can use either double () or single (‘’) inverted commas to display the output or the message. The difference between the two is minimal and will be explained at later stage in detail. In this example, the user displayed a message, or output a message. Another interesting fact is that there are two commands. Each command starts on a new line!

Activity 1

1.1. Write a statement where the computer greets you showing your name.

1.2. Write two statements where the compute greet you showing your name on one line and your surname on the next line.

Variables

Python is very good at storing of data. To store data, either storing, using or recalling data. In Python there are a few different types. However, for a start the focus is on numbers and text only. Other types will be focused on at a later stage.

Numbers

Python supports two types of numbers. The first is integers (7, 10, 12, 20000) and floating point numbers.

Integers

To define integers, assignments (to give a value to a part of RAM with a name that the user

You've reached the end of this preview. Sign up to read more!
Page 1 of 1

Reviews

What people think about Python. Easy Steps to Learning.

0
0 ratings / 0 Reviews
What did you think?
Rating: 0 out of 5 stars

Reader reviews