01 Chapter 1 - Python Programming Language_P1 2
01 Chapter 1 - Python Programming Language_P1 2
Software is a set of
A software is a set of If the instructions are
instructions on the
programs written to not correct, the
basis of which
solve a particular computer gives wrong
computer gives
problem result.
output/result.
4
CHAPTER 1: INTRODUCTION TO PYTHON
CODING
The process of transforming the program logic design into computer language format.
An act of transforming operations in each box of the flowchart in terms of the statement of the program.
The code written using programming language is also known as source code.
Coding isn’t the only task to be done to solve a problem using computer.
https://spectrum.ieee.org/top-programming-languages-2024 6
CHAPTER 1: INTRODUCTION TO PYTHON
WHY PYTHON
Unlike Java, C, C++, R, and PHP, Python is witnessing incredible
popularity and growth lately.
Python is defined as a general-purpose high-level programming
language with versatility with the feature of building different
functions (Rossum, 2018).
Python is a dynamic, open-source, and high-level programming
language that supports object-oriented and procedural
programming.
The Python language is an interpreted language that does not
depend on compilers and is executed line by line.
This also makes the language versatile and does not have any
operating system preferences.
CHAPTER 1: INTRODUCTION TO PYTHON
WHY PYTHON
Python is widely used in various fields, including data
science, web development, and artificial intelligence.
Some of the key elements of
CHAPTER 1: INTRODUCTION TO PYTHON
WHY PYTHON TYPES DESCRIPTION EXAMPLES
Represents numerical
In Python, data types are Numeric 'int' , 'float' , 'complex'
values
categories of values that Represents a collection
determine how the Sequence of ordered and indexed 'list' , 'tuple' , 'range'
values behave and what values
operations can be Represents a sequence
performed on them. Text 'str'
of characters
Here are some common
Represents a collection
data types and their Mapping 'dict'
of key-value pairs
examples:
Represents a collection
Set 'set' , 'frozenset'
of unique elements
Represents a binary
Boolean 'bool'
truth value
'bytes' , 'bytearray' ,
Binary Represents binary data
'memoryview'
CHAPTER 1: INTRODUCTION TO PYTHON
START WITH PYCHARM
https://www.jetbrains.com/pycharm/
CHAPTER 1: INTRODUCTION TO PYTHON
START WITH PYCHARM
https://www.jetbrains.com/pycharm/
CHAPTER 1: INTRODUCTION TO PYTHON
START WITH PYCHARM
In Python, we’ll try to create a variable
A variable in Python is just a name called "age" and assign a value to it, like
that represents a value, and you can this:
use it to store and manipulate data
throughout your program.
https://docs.anaconda.com/anaconda/install/
TYPES DESCRIPTION EXAMPLES
Comparison
Operators: Operators
Used to compare
values
'2 < 3' returns 'True'
CHAPTER 1: statement
of code if a condition
is true
'if x>3:'<br>
'print("x is greater than 3")'
TION TO
'if x>3: '<br>
If else of code if a condition
'print("x is greater than 3")' <br>
statement is true and another
Statements: 'print("x is
Write an algorithm and draw flowchart to find the largest number from a
list
CHAPTER 1: INTRODUCTION TO PYTHON
ASSIGNMENTS
Write an algorithm and draw flowchart of print all items from a list
CHAPTER 1: INTRODUCTION TO PYTHON
ASSIGNMENTS
Write an algorithm and draw flowchart to find the largest number from a list
CHAPTER 1: INTRODUCTION TO PYTHON
ASSIGNMENTS
01 02 03
Read N numbers For finding the sum For calculating the
from user and of the series factorial of a given
display sum of all 1+2+3+4+… up to number N.
entered numbers. N terms
PROGRAM DOCUMENTATION
Helps to those who use, maintain and extend the program in future.
Presenting the algorithm using natural language and flowcharts to solve the
following problems:
Exercise 1: Find the minimum value from a sequence of n numbers entered from the
keyboard.
Exercise 2: Input a natural number nnn and calculate the sum: S=1+2+3+⋯+n
Exercise 3: Input a natural number nnn and calculate the factorial GT=n!
Exercise 4: Input n numbers from the keyboard and sort the sequence in ascending order.
Exercise 5: Input n numbers from the keyboard and sort the sequence in descending order.
Exercise 6: Solve a quadratic equation with three coefficients a, b, and c.
Enter n numbers from the keyboard and sort them in ascending order.
Exercise 4: Input n numbers from the keyboard and sort the sequence in ascending
order.