Introduction to Core Python Programming Concepts#
Aim#
The aim of this session is to learn the Python programming language syntax and its core programming concepts and how to use them. It is the first step in learning Python programming.
Objectives#
During this practical you will learn how to:
create a project and a Python program in PyCharm
define variables
use different data types in Python
use different data structures in Python and perform different operations with them
how to call functions
how to find help
Instructions#
These notes are designed with all the details you would need to be able to perform the exercises in this session. In general, you would not need to refer to additional texts and resources as these notes have been explained in detail with accompanying visual aids and examples to explain concepts to beginners. Apart from the exercises listed below, there are also examples throughout the notes which provide insight on the concepts introduced, and therefore, it is recommended that you also run these examples as you progress through the notes.
If you are an experienced Python programmer, you might find that you already know about the content in these notes. You may want to skip sections of notes that you already know and attempt the exercises that are at the higher levels.
Exercises levels#
Exercises in this practical are labelled with the level of difficulty of the respective exercise:
Level |
Description |
---|---|
|
Level 1: Excercises in Level 1 are simple excersises designed to get you familiar with the Python syntax. If you already know how to program in Python, you may skip these exercises. |
|
Level 2: Excercises in Level 2 combine different Python programming concepts to solve simple problems. |
|
Level 3: Exercises in Level 3 test not just the understanding of the Python syntax but also how Python can be used to solve problems. |
Exercises#
This Session is composed of the following exercises.
Exercise |
Description |
Level |
---|---|---|
Arithmetic operators: In this exercise we try the different arithmetic operators. |
|
|
Variables and their types: In this exercise we explore how values and types of variables change as we apply operations on them. |
|
|
Lists: This exercise explores lists and other operations we can do on them. |
|
|
Joining strings: In this exercise we learn how to join a list of words into a string. |
|
|
Splitting strings: This exercise counts the number of words in a sentence. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|