SlideShare a Scribd company logo
1 of 25
Marathwada Mitramandal’s
COLLEGE OF ENGINEERING
Karvenagar, Pune
Accredited with ‘A++’ Grade by NAAC
Presentation
On
Core Concepts In Python
By
Mrs. Ashwini Raut
Department of Computer Engineering
Agenda
VARIABLES KEYWORDS DATA TYPES COMMENT BASIC
PROGRAMS
Variables in Python
Variables are containers for storing data values.
Python has no command for declaring a variable.
A variable is created the moment you first assign a value to it.
E.g
• x = 5
• y = "John“
• z= 5.5
print(x)
print(y)
• print(z)
Get The Type of variables
• You can get the data type of a variable with the type() function.
• E.g:
x = 5
y = "John”
z= 5.5
print(type(x))
print(type(y))
print(type(z))
Output: <class 'int’>
<class 'str’>
<class ‘float'>
<class 'str'>
Keywords
• Python has a set of keywords that are reserved words that cannot be used as
variable names, function names, or any other identifiers:
• There are 35 keywords in python 3.13 version
import keyword
print("Python keywords are...")
print(keyword.kwlist)
Data Types in Python
• It’s the type of data particular variable is holding.
• E.g: int,float.
Data types in
python
Example of Numeric Data Type
a =20
b=20.5
c=3+4j
print(type(a))
print(type(b))
print(type(c))
Output :
<class 'int’>
<class 'float’>
<class 'complex'>
String
• Strings in python are surrounded by either single quotation
marks, or double quotation marks.
'hello' is the same as "hello“
E.g:
print("Hello")
print('Hello’)
Output:
Hello
Hello
Accessing
Characters String
We will define a string in Python and access its characters using positive and
negative indexing. The 0th element will be the first character of the string
whereas the -1th element is the last character of the string.
Example
String1 = "Hello"
print("Initial String: ")
print(String1)
print("nFirst character of String is: ")
print(String1[0])
print("nLast character of String is: ")
print(String1[-1])
Output:
Initial String:
Hello
First character of String is:
H
Last character of String is:
O
List
• Lists are used to store multiple items in a single variable.
• Lists are created using square brackets:
E.g:
thislist = ["apple", "banana", "cherry"]
print(thislist)
Output: [‘apple’, ’banana’, ’cherry’] ', 'cherry']
Tuple
• Tuples are used to store multiple items in a single variable.
• A tuple is a collection which is ordered and unchangeable.
• Tuples are written with round brackets.
E.g:
thistup = ("apple", "banana", "cherry“)
print(thistup)
Output: (‘apple’, ’banana’, ’cherry’), 'banana', 'cherry']
Dictionary
• Dictionaries are used to store data values in key:value pairs. ‘
thisdict = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
print(thisdict)
Output: ‘
{"brand": "Ford","model": "Mustang", "year": 1964}
{'brand': 'Ford', 'model': 'Mustang', 'year': 1964} c
{'brand': 'Ford', 'model': 'Mustang', 'year': 1964}herry']
Comments in Python
• Comments can be used to explain
Python code.
• Comments can be used to make the
code more readable.
• Comments can be used to prevent
execution when testing code
Single Line Comment
• Single line comment is starts with #
• E.g:
#Program to print hello world
print(“Hello World!!”)
Output:
Hello World!!
Multiline Comment
• Multiline comments are enclosed with triple quotes(“””)
as multiline comments.
E.g:
“””Python Program to demonstrate multiline
comment”””
print(“Hello World”)
Output:
Hello World
Basic Python program
1.Write a program in python to perform addition of two
numbers.
num1 = 10
num2 =20
sum= num1+num2
print(“Addition of two numbers are ”,sum)
Output:
Addition of two numbers are  30
Basic Python program
2.Write a program in python to perform subtraction of two
numbers.
num1 = 30
num2 =20
sub= num1-num2
print(“Subtraction of two numbers are ”,sub)
Output:
Subtraction of two numbers are  10
Basic Python program
3.Write a program in python to perform multiplication of two
numbers.
num1 = 10
num2 =20
mult= num1*num2
print(“Multiplication of two numbers are ”,mult)
Output:
Multiplication of two numbers are  200
Basic Python program
4.Write a program in python to perform division of two
numbers.
num1 = 20
num2 =10
div= num1/num2
print(“Division of two numbers are ”,div)
Output:
Division of two numbers are  2
Basic Python program
• Write a program to perform addition of two numbers (take numbers
from users)
num1 = int(input(“Please enter value for num1”))
num2 = int(input(“Please enter value for num2”))
sum = num1 + num2
print(“The sum of two numbers”, sum)
Output :
Please enter value for num110
Please enter value for num290
The sum of two numbers100
Core Concept_Python.pptx

More Related Content

Similar to Core Concept_Python.pptx

Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
DRVaibhavmeshram1
 

Similar to Core Concept_Python.pptx (20)

python_class.pptx
python_class.pptxpython_class.pptx
python_class.pptx
 
Python ppt
Python pptPython ppt
Python ppt
 
Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02Basic Python Programming: Part 01 and Part 02
Basic Python Programming: Part 01 and Part 02
 
Python- strings
Python- stringsPython- strings
Python- strings
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Python basics
Python basicsPython basics
Python basics
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
 
Python-Cheat-Sheet.pdf
Python-Cheat-Sheet.pdfPython-Cheat-Sheet.pdf
Python-Cheat-Sheet.pdf
 
Python programming
Python  programmingPython  programming
Python programming
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Python basics
Python basicsPython basics
Python basics
 
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
 
Python Basics by Akanksha Bali
Python Basics by Akanksha BaliPython Basics by Akanksha Bali
Python Basics by Akanksha Bali
 
Pythonintro
PythonintroPythonintro
Pythonintro
 
Python
PythonPython
Python
 

Recently uploaded

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 

Core Concept_Python.pptx

  • 1. Marathwada Mitramandal’s COLLEGE OF ENGINEERING Karvenagar, Pune Accredited with ‘A++’ Grade by NAAC Presentation On Core Concepts In Python By Mrs. Ashwini Raut Department of Computer Engineering
  • 2. Agenda VARIABLES KEYWORDS DATA TYPES COMMENT BASIC PROGRAMS
  • 3. Variables in Python Variables are containers for storing data values. Python has no command for declaring a variable. A variable is created the moment you first assign a value to it. E.g • x = 5 • y = "John“ • z= 5.5 print(x) print(y) • print(z)
  • 4. Get The Type of variables • You can get the data type of a variable with the type() function. • E.g: x = 5 y = "John” z= 5.5 print(type(x)) print(type(y)) print(type(z)) Output: <class 'int’> <class 'str’> <class ‘float'> <class 'str'>
  • 5. Keywords • Python has a set of keywords that are reserved words that cannot be used as variable names, function names, or any other identifiers: • There are 35 keywords in python 3.13 version import keyword print("Python keywords are...") print(keyword.kwlist)
  • 6. Data Types in Python • It’s the type of data particular variable is holding. • E.g: int,float.
  • 8.
  • 9. Example of Numeric Data Type a =20 b=20.5 c=3+4j print(type(a)) print(type(b)) print(type(c)) Output : <class 'int’> <class 'float’> <class 'complex'>
  • 10.
  • 11. String • Strings in python are surrounded by either single quotation marks, or double quotation marks. 'hello' is the same as "hello“ E.g: print("Hello") print('Hello’) Output: Hello Hello
  • 12. Accessing Characters String We will define a string in Python and access its characters using positive and negative indexing. The 0th element will be the first character of the string whereas the -1th element is the last character of the string.
  • 13. Example String1 = "Hello" print("Initial String: ") print(String1) print("nFirst character of String is: ") print(String1[0]) print("nLast character of String is: ") print(String1[-1]) Output: Initial String: Hello First character of String is: H Last character of String is: O
  • 14. List • Lists are used to store multiple items in a single variable. • Lists are created using square brackets: E.g: thislist = ["apple", "banana", "cherry"] print(thislist) Output: [‘apple’, ’banana’, ’cherry’] ', 'cherry']
  • 15. Tuple • Tuples are used to store multiple items in a single variable. • A tuple is a collection which is ordered and unchangeable. • Tuples are written with round brackets. E.g: thistup = ("apple", "banana", "cherry“) print(thistup) Output: (‘apple’, ’banana’, ’cherry’), 'banana', 'cherry']
  • 16. Dictionary • Dictionaries are used to store data values in key:value pairs. ‘ thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 } print(thisdict) Output: ‘ {"brand": "Ford","model": "Mustang", "year": 1964} {'brand': 'Ford', 'model': 'Mustang', 'year': 1964} c {'brand': 'Ford', 'model': 'Mustang', 'year': 1964}herry']
  • 17. Comments in Python • Comments can be used to explain Python code. • Comments can be used to make the code more readable. • Comments can be used to prevent execution when testing code
  • 18. Single Line Comment • Single line comment is starts with # • E.g: #Program to print hello world print(“Hello World!!”) Output: Hello World!!
  • 19. Multiline Comment • Multiline comments are enclosed with triple quotes(“””) as multiline comments. E.g: “””Python Program to demonstrate multiline comment””” print(“Hello World”) Output: Hello World
  • 20. Basic Python program 1.Write a program in python to perform addition of two numbers. num1 = 10 num2 =20 sum= num1+num2 print(“Addition of two numbers are ”,sum) Output: Addition of two numbers are  30
  • 21. Basic Python program 2.Write a program in python to perform subtraction of two numbers. num1 = 30 num2 =20 sub= num1-num2 print(“Subtraction of two numbers are ”,sub) Output: Subtraction of two numbers are  10
  • 22. Basic Python program 3.Write a program in python to perform multiplication of two numbers. num1 = 10 num2 =20 mult= num1*num2 print(“Multiplication of two numbers are ”,mult) Output: Multiplication of two numbers are  200
  • 23. Basic Python program 4.Write a program in python to perform division of two numbers. num1 = 20 num2 =10 div= num1/num2 print(“Division of two numbers are ”,div) Output: Division of two numbers are  2
  • 24. Basic Python program • Write a program to perform addition of two numbers (take numbers from users) num1 = int(input(“Please enter value for num1”)) num2 = int(input(“Please enter value for num2”)) sum = num1 + num2 print(“The sum of two numbers”, sum) Output : Please enter value for num110 Please enter value for num290 The sum of two numbers100

Editor's Notes

  1. 1