SlideShare a Scribd company logo
COMPUTING APPLICATIONS
WITH PYTHON
UNIT - I
Introduction:
What is Python?
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.
History of Python:
• In the late 1980s, history was about to be written. It was that time when working on Python started. Soon
after that, Guido Van Rossum began doing its application-based work in December of 1989 at Centrum
Wiskunde & Informatica (CWI) which is situated in the Netherlands.
• It was started firstly as a hobby project because he was looking for an interesting project to keep him
occupied during Christmas.
• The programming language in which Python is said to have succeeded is ABC Programming Language,
which had interfacing with the Amoeba Operating System and had the feature of exception handling.
• The inspiration for the name came from BBC’s TV Show – ‘Monty Python’s Flying Circus’, as he was a big
fan of the TV show and also he wanted a short, unique and slightly mysterious name for his invention and
hence he named it Python!
• The language was finally released in 1991. When it was released, it used a lot fewer codes to
express the concepts, when we compare it with Java, C++ & C.
• Its main objective is to provide code readability and advanced developer productivity.
Why to use Python (Need for Python Programming):
The following are the primary factors to use python:
1. Python is object-oriented Structure supports such concepts as polymorphism, operation
overloading and
multiple inheritance.
2. Indentation: Indentation is one of the greatest feature in python
3. It’s free (open source) Downloading python and installing python is free and easy
4. It’s Powerful
• Dynamic typing
• Built-in types and tools
• Library utilities
• Automatic memory management
5. It’s Portable
• Python runs virtually every major platform used today
• As long as you have a compactable python interpreter installed, python programs will run in exactly the same
manner, irrespective of platform.
6. It’s easy to use and learn
• No intermediate compile
• Python Programs are compiled automatically to an intermediate form called byte code, which the interpreter
then reads.
• This gives python the development speed of an interpreter without the performance loss inherent in purely
interpreted languages.
• Structure and syntax are pretty intuitive and easy to grasp.
7. Interpreted Language
Python is processed at runtime by python Interpreter
8. Interactive Programming Language
Users can interact with the python interpreter directly for writing the programs
9. Straight forward syntax
The formation of python syntax is simple and straight forward which also makes it popular.
Variables:
• Variables are nothing but reserved memory locations to store values. This means that when you create a
variable you reserve some space in memory.
• Based on the data type of a variable, the interpreter allocates memory and decides what can be stored in the
reserved memory. Therefore, by assigning different data types to variables, you can store integers, decimals or
characters in these variables.
Rules for Python variables:
• A variable name must start with a letter or the underscore character
• A variable name cannot start with a number
• A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9,and _ )
• Variable names are case-sensitive (age, Age and AGE are three different variables)
Assigning Values to Variables:
Python variables do not need explicit declaration to reserve memory space. The declaration happens
automatically when you assign a value to a variable. The equal sign (=) is used to assign values to variables.
The operand to the left of the = operator is the name of the variable and the operand to the right of the =
operator is the value stored in the variable.
For example −
a= 100 # An integer assignment
b = 1000.0 # A floating point
c = "John“ # A string
print (a)
print (b)
print (c)
This produces the following result −
100
1000.0
John
Multiple Assignment:
Python allows you to assign a single value to several variables simultaneously.
For example :
a = b = c = 1
Here, an integer object is created with the value 1, and all three variables are assigned to the same memory
location. You can also assign multiple objects to multiple variables.
For example −
a, b, c = 1,2," MREC“
Here, two integer objects with values 1 and 2 are assigned to variables a and b respectively, and one string
object with the value "john" is assigned to the variable c.
Output Variables:
The Python print statement is often used to output variables. Variables do not need to be declared with any
particular type and can even change type after they have been set.
x = 5 # x is of type int
x = " MREC " # x is now of type str
print(x)
Output: MREC
• To combine both text and a variable, Python uses the “+” character:
Example:
x = "awesome"
print("Python is " + x)
Output:
Python is awesome
• You can also use the + character to add a variable to another variable:
Example:
x = "Python is "
y = "awesome"
z = x + y
print(z)
Output:
Python is awesome
Keywords:
Keyword Description
and A logical operator
as To create an alias
assert For debugging
break To break out of a loop
class To define a class
continue To continue to the next iteration of a loop
def To define a function
del To delete an object
elif Used in conditional statements, same as else if
else Used in conditional statements
False Boolean value, result of comparison operations
finally Used with exceptions, a block of code that will be
executed no matter if there is an exception or not
for To create a for loop
from To import specific parts of a module
global To declare a global variable
if To make a conditional statement
import To import a module
in To check if a value is present in a list, tuple, etc.
is To test if two variables are equal
lambda To create an anonymous function
None Represents a null value
nonlocal To declare a non-local variable
not A logical operator
or A logical operator
pass A null statement, a statement that will do nothing
raise To raise an exception
return To exit a function and return a value
True Boolean value, result of comparison operations
try To make a try...except statement
while To create a while loop
with Used to simplify exception handling
yield To end a function, returns a generator
Strings
Strings in python are surrounded by either single quotation marks, or double quotation marks.
'hello' is the same as "hello".
Python treats single quotes the same as double quotes.
print("Hello")
print('Hello’)
Assign String to a Variable:
Assigning a string to a variable is done with the variable name followed by an equal sign and the
string:
Example:
a = "Hello"
print(a)
Multiline Strings:
You can assign a multiline string to a variable by using three quotes:
a = """Lorem ipsum dolor sit a met, consectetur a dipiscing elit, sed do eiusmod tempor
in cididuntut labore et dolore magna aliqua."""
print(a)
Strings are Arrays:
Like many other popular programming languages, strings in Python are arrays of bytes
representing unicode characters.
Square brackets can be used to access elements of the string.
Example:
Get the character at position 1 (remember that the first character has the position 0):
a = "Hello, World!"
print(a[1])
Booleans:
In programming you often need to know if an expression is true or false.
You can evaluate any expression in Python, and get one of two answers, true or false.
When you compare two values, the expression is evaluated and Python returns the Boolean
answer:
Example:
print(10 > 9)
print(10 == 9)
print(10 < 9)
When you run a condition in an if statement, Python returns True or False:
Example:
a = 200
b = 33
if b > a:
print("b is greater than a")
else:
print("b is not greater than a")
Output:
b is not greater than a

More Related Content

PPTX
python notes for MASTER OF COMPUTER APPLIICATION_ppt.pptx
PPTX
INTRODUCTION TO PYTHON.pptx
PPTX
Python (Data Analysis) cleaning and visualize
PDF
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
PPT
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
PDF
Python Programing Bio computing,basic concepts lab,,
PDF
Python-01| Fundamentals
PPT
program on python what is python where it was started by whom started
python notes for MASTER OF COMPUTER APPLIICATION_ppt.pptx
INTRODUCTION TO PYTHON.pptx
Python (Data Analysis) cleaning and visualize
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
Python Programing Bio computing,basic concepts lab,,
Python-01| Fundamentals
program on python what is python where it was started by whom started

Similar to Unit -1 CAP.pptx (20)

PPT
Python Over View (Python for mobile app Devt)1.ppt
PPT
Python slides for the beginners to learn
PPT
Py-Slides-1.ppt1234444444444444444444444444444444444444444
PPTX
modul-python-part1.pptx
PPT
Py-Slides-1.pptPy-Slides-1.pptPy-Slides-1.pptPy-Slides-1.ppt
PPTX
Introduction to Python Programming .pptx
PDF
Python (3).pdf
PPTX
Python fundamentals
PDF
Python Programming
PPTX
Basic concept of Python.pptx includes design tool, identifier, variables.
PPTX
Python ppt
PPTX
Python unit 2 is added. Has python related programming content
PPTX
Python 01.pptx
PDF
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
PDF
CSC2308 - PRINCIPLE OF PROGRAMMING II.pdf
PDF
Python basics_ part1
PPTX
UNIT 1 .pptx
PDF
علم البيانات - Data Sience
PDF
PPT
Introduction to python
Python Over View (Python for mobile app Devt)1.ppt
Python slides for the beginners to learn
Py-Slides-1.ppt1234444444444444444444444444444444444444444
modul-python-part1.pptx
Py-Slides-1.pptPy-Slides-1.pptPy-Slides-1.pptPy-Slides-1.ppt
Introduction to Python Programming .pptx
Python (3).pdf
Python fundamentals
Python Programming
Basic concept of Python.pptx includes design tool, identifier, variables.
Python ppt
Python unit 2 is added. Has python related programming content
Python 01.pptx
python-online&offline-training-in-kphb-hyderabad (1) (1).pdf
CSC2308 - PRINCIPLE OF PROGRAMMING II.pdf
Python basics_ part1
UNIT 1 .pptx
علم البيانات - Data Sience
Introduction to python
Ad

Recently uploaded (20)

PPTX
TE-AI-Unit VI notes using planning model
PPTX
Practice Questions on recent development part 1.pptx
PDF
LEAP-1B presedntation xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PPT
SCOPE_~1- technology of green house and poyhouse
PPTX
The-Looming-Shadow-How-AI-Poses-Dangers-to-Humanity.pptx
PDF
Structs to JSON How Go Powers REST APIs.pdf
PDF
Monitoring Global Terrestrial Surface Water Height using Remote Sensing - ARS...
PPTX
AgentX UiPath Community Webinar series - Delhi
PDF
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
PPTX
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
PDF
6th International Conference on Artificial Intelligence and Machine Learning ...
PPTX
Simulation of electric circuit laws using tinkercad.pptx
PPTX
Chapter----five---Resource Recovery.pptx
PPTX
meets orient on the new industry intereacting skills .pptx
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPT
Chapter 6 Design in software Engineeing.ppt
PDF
July 2025: Top 10 Read Articles Advanced Information Technology
PPTX
anatomy of limbus and anterior chamber .pptx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Top 10 read articles In Managing Information Technology.pdf
TE-AI-Unit VI notes using planning model
Practice Questions on recent development part 1.pptx
LEAP-1B presedntation xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SCOPE_~1- technology of green house and poyhouse
The-Looming-Shadow-How-AI-Poses-Dangers-to-Humanity.pptx
Structs to JSON How Go Powers REST APIs.pdf
Monitoring Global Terrestrial Surface Water Height using Remote Sensing - ARS...
AgentX UiPath Community Webinar series - Delhi
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
Unit 5 BSP.pptxytrrftyyydfyujfttyczcgvcd
6th International Conference on Artificial Intelligence and Machine Learning ...
Simulation of electric circuit laws using tinkercad.pptx
Chapter----five---Resource Recovery.pptx
meets orient on the new industry intereacting skills .pptx
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Chapter 6 Design in software Engineeing.ppt
July 2025: Top 10 Read Articles Advanced Information Technology
anatomy of limbus and anterior chamber .pptx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Top 10 read articles In Managing Information Technology.pdf
Ad

Unit -1 CAP.pptx

  • 2. Introduction: What is Python? Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. History of Python: • In the late 1980s, history was about to be written. It was that time when working on Python started. Soon after that, Guido Van Rossum began doing its application-based work in December of 1989 at Centrum Wiskunde & Informatica (CWI) which is situated in the Netherlands. • It was started firstly as a hobby project because he was looking for an interesting project to keep him occupied during Christmas. • The programming language in which Python is said to have succeeded is ABC Programming Language, which had interfacing with the Amoeba Operating System and had the feature of exception handling. • The inspiration for the name came from BBC’s TV Show – ‘Monty Python’s Flying Circus’, as he was a big fan of the TV show and also he wanted a short, unique and slightly mysterious name for his invention and hence he named it Python!
  • 3. • The language was finally released in 1991. When it was released, it used a lot fewer codes to express the concepts, when we compare it with Java, C++ & C. • Its main objective is to provide code readability and advanced developer productivity. Why to use Python (Need for Python Programming): The following are the primary factors to use python: 1. Python is object-oriented Structure supports such concepts as polymorphism, operation overloading and multiple inheritance. 2. Indentation: Indentation is one of the greatest feature in python 3. It’s free (open source) Downloading python and installing python is free and easy
  • 4. 4. It’s Powerful • Dynamic typing • Built-in types and tools • Library utilities • Automatic memory management 5. It’s Portable • Python runs virtually every major platform used today • As long as you have a compactable python interpreter installed, python programs will run in exactly the same manner, irrespective of platform. 6. It’s easy to use and learn • No intermediate compile • Python Programs are compiled automatically to an intermediate form called byte code, which the interpreter then reads. • This gives python the development speed of an interpreter without the performance loss inherent in purely interpreted languages. • Structure and syntax are pretty intuitive and easy to grasp.
  • 5. 7. Interpreted Language Python is processed at runtime by python Interpreter 8. Interactive Programming Language Users can interact with the python interpreter directly for writing the programs 9. Straight forward syntax The formation of python syntax is simple and straight forward which also makes it popular.
  • 6. Variables: • Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in memory. • Based on the data type of a variable, the interpreter allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to variables, you can store integers, decimals or characters in these variables. Rules for Python variables: • A variable name must start with a letter or the underscore character • A variable name cannot start with a number • A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9,and _ ) • Variable names are case-sensitive (age, Age and AGE are three different variables)
  • 7. Assigning Values to Variables: Python variables do not need explicit declaration to reserve memory space. The declaration happens automatically when you assign a value to a variable. The equal sign (=) is used to assign values to variables. The operand to the left of the = operator is the name of the variable and the operand to the right of the = operator is the value stored in the variable. For example − a= 100 # An integer assignment b = 1000.0 # A floating point c = "John“ # A string print (a) print (b) print (c) This produces the following result − 100 1000.0 John
  • 8. Multiple Assignment: Python allows you to assign a single value to several variables simultaneously. For example : a = b = c = 1 Here, an integer object is created with the value 1, and all three variables are assigned to the same memory location. You can also assign multiple objects to multiple variables. For example − a, b, c = 1,2," MREC“ Here, two integer objects with values 1 and 2 are assigned to variables a and b respectively, and one string object with the value "john" is assigned to the variable c. Output Variables: The Python print statement is often used to output variables. Variables do not need to be declared with any particular type and can even change type after they have been set. x = 5 # x is of type int x = " MREC " # x is now of type str print(x) Output: MREC
  • 9. • To combine both text and a variable, Python uses the “+” character: Example: x = "awesome" print("Python is " + x) Output: Python is awesome • You can also use the + character to add a variable to another variable: Example: x = "Python is " y = "awesome" z = x + y print(z) Output: Python is awesome
  • 11. Keyword Description and A logical operator as To create an alias assert For debugging break To break out of a loop class To define a class continue To continue to the next iteration of a loop def To define a function del To delete an object elif Used in conditional statements, same as else if else Used in conditional statements
  • 12. False Boolean value, result of comparison operations finally Used with exceptions, a block of code that will be executed no matter if there is an exception or not for To create a for loop from To import specific parts of a module global To declare a global variable if To make a conditional statement import To import a module in To check if a value is present in a list, tuple, etc. is To test if two variables are equal
  • 13. lambda To create an anonymous function None Represents a null value nonlocal To declare a non-local variable not A logical operator or A logical operator pass A null statement, a statement that will do nothing raise To raise an exception return To exit a function and return a value True Boolean value, result of comparison operations try To make a try...except statement while To create a while loop with Used to simplify exception handling yield To end a function, returns a generator
  • 14. Strings Strings in python are surrounded by either single quotation marks, or double quotation marks. 'hello' is the same as "hello". Python treats single quotes the same as double quotes. print("Hello") print('Hello’) Assign String to a Variable: Assigning a string to a variable is done with the variable name followed by an equal sign and the string: Example: a = "Hello" print(a)
  • 15. Multiline Strings: You can assign a multiline string to a variable by using three quotes: a = """Lorem ipsum dolor sit a met, consectetur a dipiscing elit, sed do eiusmod tempor in cididuntut labore et dolore magna aliqua.""" print(a) Strings are Arrays: Like many other popular programming languages, strings in Python are arrays of bytes representing unicode characters. Square brackets can be used to access elements of the string. Example: Get the character at position 1 (remember that the first character has the position 0): a = "Hello, World!" print(a[1])
  • 16. Booleans: In programming you often need to know if an expression is true or false. You can evaluate any expression in Python, and get one of two answers, true or false. When you compare two values, the expression is evaluated and Python returns the Boolean answer: Example: print(10 > 9) print(10 == 9) print(10 < 9)
  • 17. When you run a condition in an if statement, Python returns True or False: Example: a = 200 b = 33 if b > a: print("b is greater than a") else: print("b is not greater than a") Output: b is not greater than a