0% found this document useful (0 votes)
3 views18 pages

Python Introduction

This document provides an introduction to Python programming, covering key concepts such as variables, data types, input/output functions, and operators. It explains how variables are created and the rules for naming them, along with the types of basic data including integers, floating points, and booleans. Additionally, it discusses expressions and provides examples of operators used in Python.

Uploaded by

tahacer99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views18 pages

Python Introduction

This document provides an introduction to Python programming, covering key concepts such as variables, data types, input/output functions, and operators. It explains how variables are created and the rules for naming them, along with the types of basic data including integers, floating points, and booleans. Additionally, it discusses expressions and provides examples of operators used in Python.

Uploaded by

tahacer99
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Computer Programming

Dr. Hilal ARSLAN

Week 2: Introduction to Python

H. Arslan Computer Programming Week 2: Introduction to Python 1 / 18


Outline

Introduction to Python
• Variables and assignments
• Input and Output functions
• Operators and Expressions

H. Arslan Computer Programming Week 2: Introduction to Python 2 / 18


python
- Command Line

H. Arslan Computer Programming Week 2: Introduction to Python 3 / 18


Basic Data

Numbers
• Integers
• Floating points
• Booleans (True or False)

H. Arslan Computer Programming Week 2: Introduction to Python 4 / 18


Expressions

• A sequence of operands and operators, like a + b - 5 , is called an


expression.

H. Arslan Computer Programming Week 2: Introduction to Python 5 / 18


Variables
• Python has no command for declaring a variable
• A variable is created the moment you first assign a value to it

• Variables do not need to be declared with any particular type, and can
even change type after they have been set

H. Arslan Computer Programming Week 2: Introduction to Python 6 / 18


Variables

H. Arslan Computer Programming Week 2: Introduction to Python 7 / 18


Variables

• There are certain rules for defining variable name.


• Special symbols are not used in the first letter of the variable.
• Variable names do not start with a digit.
• Variable names are case sensitive.

H. Arslan Computer Programming Week 2: Introduction to Python 8 / 18


Visualize: http://www.pythontutor.com/visualize.htmlmode=edit
H. Arslan Computer Programming Week 2: Introduction to Python 9 / 18
Strings

• String variables can be declared either by using single or double quotes

H. Arslan Computer Programming Week 2: Introduction to Python 10 / 18


Operators

H. Arslan Computer Programming Week 2: Introduction to Python 11 / 18


Example: Operators

H. Arslan Computer Programming Week 2: Introduction to Python 12 / 18


Assignment Operators

H. Arslan Computer Programming Week 2: Introduction to Python 13 / 18


Example

H. Arslan Computer Programming Week 2: Introduction to Python 14 / 18


Operators

H. Arslan Computer Programming Week 2: Introduction to Python 15 / 18


Example

H. Arslan Computer Programming Week 2: Introduction to Python 16 / 18


Example

You might also like