Title: Lesson 2: Introduction to programming
Course: Basic scripting and programming > Section: Course Content

Take your first steps in Python programming. The first basic building blocks of any programming language, variables, expressions and statements will be discussed.

Objectives:

- First steps towards programming
- Variables, expressions, and statements

Entrance requirements:

- Lesson 1 should have been completed

Required materials:

- Computer with Python
- The course book “Think Python”

Learning outcomes:

At the end of the lesson the student:

- knows about values and types
- knows about variables, variable names and keywords
- knows about operators and operands
- knows about expressions and statements
- knows about interactive mode and script mode
- knows about the order of operations
- knows about strings operations
- knows about comments
- is able to apply all of the above
- is able to debug a small program

Learning activities:

- Read chapter 2, “Variables, expressions and statements” of the book “Think Python”

Tasks:

- Do exercise 2.1 of the book, Python syntax
- Do exercise 2.2 of the book, using the Python interpreter as a calculator

Answer the following questions:

How can you check whether the variable myvar is integer or not?

                □ int(myvar)

                □ type(myvar)

                □ id(myvar)

                □ print myvar

Which of the following are valid Python identifiers (variable names)?

                □ MyVariable

                □ my_var

                □ 2numbers

                □ XYZ

                □ My-guess

                □ sumOfNumbers

SUBMIT all your answers in a PDF document!

Planned time frame:

5 hours