- Python is a programming language created by Guido van Rossum in 1991. It has two major versions: Python 2.0 released in 2000 and Python 3.0 released in 2008. Python 3.0 is the latest version and is not completely backward compatible with Python 2.0.
- Python is used for machine learning, data science, web development, game development, and more. Popular frameworks include TensorFlow, Pandas, Django, and PyGame.
- The document discusses installing Python, different integrated development environments (IDEs) like PyCharm and Visual Studio Code, and covers basic Python concepts like data types, variables, operators, and more.
Python is one of the powerful, high-level, easy to learn programming language that
provides a huge number of applications. Some of its features, such as being object-oriented
and open source, having numerous IDE’s, etc. make it one of the most in-demand
programming languages of the present IT industry.
According to TIOBE index, as of January 2020, Python is one of the popular programming
languages. By looking at the popularity of this programming language, many IT
professionals, both beginners as well as experienced alike, are willing to build their career
as a Python developer
Python is a widely used programming language that offers several unique features and advantages compared to languages like Java and C++. Our Python tutorial thoroughly explains Python basics and advanced concepts, starting with installation, conditional statements, loops, built-in data structures, Object-Oriented Programming, Generators, Exception Handling, Python RegEx, and many other concepts. This tutorial is designed for beginners and working professionals.
Python is one of the powerful, high-level, easy to learn programming language that
provides a huge number of applications. Some of its features, such as being object-oriented
and open source, having numerous IDE’s, etc. make it one of the most in-demand
programming languages of the present IT industry.
According to TIOBE index, as of January 2020, Python is one of the popular programming
languages. By looking at the popularity of this programming language, many IT
professionals, both beginners as well as experienced alike, are willing to build their career
as a Python developer
Python is a widely used programming language that offers several unique features and advantages compared to languages like Java and C++. Our Python tutorial thoroughly explains Python basics and advanced concepts, starting with installation, conditional statements, loops, built-in data structures, Object-Oriented Programming, Generators, Exception Handling, Python RegEx, and many other concepts. This tutorial is designed for beginners and working professionals.
Python Basics: A Complete Introduction to Python3.Your Complete Python Curriculum— With Exercises, Interactive Quizzeresources, and Sample python programs.Python for beginners to excel in their careers in programming
Python tutorial for beginners - Tib academyTIB Academy
Get python training through simple tutorial from TIB Academy, through this python tutorial you can lean more topics of python. you can download python tutorial free as PPT
Tweepy is an open source Python package that gives you a very convenient way to access the Twitter API with Python. Tweepy includes a set of classes and methods that represent Twitter's models and API endpoints, and it transparently handles various implementation details, such as: Data encoding and decoding.
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014)
Amazon:
Zappos (Acquired in 2009)
Twitch (Acquired in 2014)
Microsoft Corporation:
LinkedIn (Acquired in 2016)
Skype (Acquired in 2011)
Apple Inc.:
Beats Electronics (Acquired in 2014)
Shazam (Acquisition announced in 2017, completed in 2018)
Oracle Corporation:
Sun Microsystems (Acquired in 2010)
Siebel Systems (Acquired in 2006)
IBM (International Business Machines Corporation):
Cognos (Acquired in 2007)
SPSS (Acquired in 2009)
Salesforce:
Tableau Software (Acquired in 2019)
MuleSoft (Acquired in 2018)
Cisco Systems:
WebEx (Acquired in 2007)
Meraki (Acquired in 2012)
Intel Corporation:
McAfee (Acquired in 2011)
Altera Corporation (Acquired in 2015)
These are just a few examples of acquisitions made by companies prior to the implementation of GST. These acquisitions have played significant roles in shaping the strategies and offerings of these tech giants.
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014)
Amazon:
Zappos (Acquired in 2009)
Twitch (Acquired in 2014)
Microsoft Corporation:
LinkedIn (Acquired in 2016)
Skype (Acquired in 2011)
Apple Inc.:
Beats Electronics (Acquired in 2014)
Shazam (Acquisition announced in 2017, completed in 2018)
Oracle Corporation:
Sun Microsystems (Acquired in 2010)
Siebel Systems (Acquired in 2006)
IBM (International Business Machines Corporation):
Cognos (Acquired in 2007)
SPSS (Acquired in 2009)
Salesforce:
Tableau Software (Acquired in 2019)
MuleSoft (Acquired in 2018)
Cisco Systems:
WebEx (Acquired in 2007)
Meraki (Acquired in 2012)
Intel Corporation:
McAfee (Acquired in 2011)
Altera Corporation (Acquired in 2015)
These are just a few examples of acquisitions made by companies prior to the implementation of GST. These acquisitions have played significant roles in shaping the strategies and offerings of these tech giants.
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014
SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL
This is a presentation which is an introduction to python language.
The presentation is contributed by me for educational purpose and this presentation is
Only introduction.
The Basic python data types and how to use python for Data Science,
Excellence Technology is one of the best python training institute in Chandigarh. Python is one of the most trending technology in these days. It is a general purpose programming language. That’s why, you can use the programming language for developing both desktop and web applications. to become a full stack web developer is always the best choice. Excellence Technology is the top ISO Satisfied company in Chandigarh & Mohali. It provides best digital marketing training, PHP , Java, top Python course in Chandigarh and also providing 6months/3months/45days/28days industrial training with best practical knowledge.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Python Basics: A Complete Introduction to Python3.Your Complete Python Curriculum— With Exercises, Interactive Quizzeresources, and Sample python programs.Python for beginners to excel in their careers in programming
Python tutorial for beginners - Tib academyTIB Academy
Get python training through simple tutorial from TIB Academy, through this python tutorial you can lean more topics of python. you can download python tutorial free as PPT
Tweepy is an open source Python package that gives you a very convenient way to access the Twitter API with Python. Tweepy includes a set of classes and methods that represent Twitter's models and API endpoints, and it transparently handles various implementation details, such as: Data encoding and decoding.
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014)
Amazon:
Zappos (Acquired in 2009)
Twitch (Acquired in 2014)
Microsoft Corporation:
LinkedIn (Acquired in 2016)
Skype (Acquired in 2011)
Apple Inc.:
Beats Electronics (Acquired in 2014)
Shazam (Acquisition announced in 2017, completed in 2018)
Oracle Corporation:
Sun Microsystems (Acquired in 2010)
Siebel Systems (Acquired in 2006)
IBM (International Business Machines Corporation):
Cognos (Acquired in 2007)
SPSS (Acquired in 2009)
Salesforce:
Tableau Software (Acquired in 2019)
MuleSoft (Acquired in 2018)
Cisco Systems:
WebEx (Acquired in 2007)
Meraki (Acquired in 2012)
Intel Corporation:
McAfee (Acquired in 2011)
Altera Corporation (Acquired in 2015)
These are just a few examples of acquisitions made by companies prior to the implementation of GST. These acquisitions have played significant roles in shaping the strategies and offerings of these tech giants.
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014)
Amazon:
Zappos (Acquired in 2009)
Twitch (Acquired in 2014)
Microsoft Corporation:
LinkedIn (Acquired in 2016)
Skype (Acquired in 2011)
Apple Inc.:
Beats Electronics (Acquired in 2014)
Shazam (Acquisition announced in 2017, completed in 2018)
Oracle Corporation:
Sun Microsystems (Acquired in 2010)
Siebel Systems (Acquired in 2006)
IBM (International Business Machines Corporation):
Cognos (Acquired in 2007)
SPSS (Acquired in 2009)
Salesforce:
Tableau Software (Acquired in 2019)
MuleSoft (Acquired in 2018)
Cisco Systems:
WebEx (Acquired in 2007)
Meraki (Acquired in 2012)
Intel Corporation:
McAfee (Acquired in 2011)
Altera Corporation (Acquired in 2015)
These are just a few examples of acquisitions made by companies prior to the implementation of GST. These acquisitions have played significant roles in shaping the strategies and offerings of these tech giants.
If you're referring to acquisitions made by companies prior to the implementation of the Goods and Services Tax (GST), here are some acquisitions that occurred before GST was introduced:
Facebook (Meta Platforms, Inc.):
Instagram (Acquired in 2012)
WhatsApp (Acquired in 2014)
Oculus VR (Acquired in 2014)
Alphabet Inc. (Google):
YouTube (Acquired in 2006)
DoubleClick (Acquired in 2008)
Nest Labs (Acquired in 2014
SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL SAMCSCMLA SCACLSALS CS L LSLSL
This is a presentation which is an introduction to python language.
The presentation is contributed by me for educational purpose and this presentation is
Only introduction.
The Basic python data types and how to use python for Data Science,
Excellence Technology is one of the best python training institute in Chandigarh. Python is one of the most trending technology in these days. It is a general purpose programming language. That’s why, you can use the programming language for developing both desktop and web applications. to become a full stack web developer is always the best choice. Excellence Technology is the top ISO Satisfied company in Chandigarh & Mohali. It provides best digital marketing training, PHP , Java, top Python course in Chandigarh and also providing 6months/3months/45days/28days industrial training with best practical knowledge.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Francesca Gottschalk - How can education support child empowerment.pptxEduSkills OECD
Francesca Gottschalk from the OECD’s Centre for Educational Research and Innovation presents at the Ask an Expert Webinar: How can education support child empowerment?
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Model Attribute Check Company Auto PropertyCeline George
In Odoo, the multi-company feature allows you to manage multiple companies within a single Odoo database instance. Each company can have its own configurations while still sharing common resources such as products, customers, and suppliers.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
2. Scope and
Application
02
Python
real-world
applications
and their scope
Installation
03
Understanding
the process of
installation of
python
Python Basics
04
Understanding
the basics of
python
Python:
Introduction
and Different
Versions
01
An introduction to
python programming
language, its versions,
and their comparative
study
Agenda
4. Python is a programming
language that was created by
Guido van Rossum
It was first released in 1991
Features of python
programming language
Easy to learn, easy to code
Object oriented elements
Platform independent
Interpreted
Python: Introduction
5. There are two major versions of python, python 2.0, and python 3.0.
• Python 2.0 was released in the year 2000.
• Python 3.0 was released in the year 2008.
• Python 3.0 is the latest major release of python, and we will be using this version to write codes.
Python: Versions
IMPORTANT!
Python 3.0 is NOT completely backward-compatible with python 2.0.
6. Python: Versions Comparison
Basis of comparison Python 3 Python 2
Release Date 2008 2000
Function print print ("hello") print "hello*
Division of Integers
Whenever two integers are divided, you get a float
value
When two integers are divided, you always provide
integer value.
Unicode In Python 3, default storing of strings is Unicode.
To store Unicode string value, you require to define
them with "u".
Syntax The syntax is simpler and easily understandable.
The syntax of Python 2 was comparatively difficult to
understand.
Rules of ordering
Comparisons
In this version. Rules of ordering comparisons have
been simplified.
Rules of ordering comparison are very complex.
Iteration
The new Range() function introduced to perform
iterations.
In Python 2, the xrange() is used for iterations.
7. Python is used for:
Machine Learning
Data Science
Web Application
Development
Game Development
Python: Applications
Library Use
pymongo Database connectivity
TensorFlow Performing high-level computation
Matplotlib Plotting numerical data
Pandas Data analysis
PyGame Develop games
8. • Machine learning is the study of computer algorithms that can improve automatically through
experience and by the use of data. It is a part of artificial intelligence.
• Machine Learning algorithms are fed with large amount of data and then these algorithms predict
outcomes of the given problems using python.
Machine Learning Algorithms in Python:
• Linear regression
• Decision tree
• Logistic regression
• Support Vector Machines (SVM)
• Naive Bayes
Python: Versions
Python for machine learning
9. • Data science is an interdisciplinary field that uses scientific methods, processes, algorithms, and systems
to extract knowledge and insights from noisy, structured, and unstructured data, and apply knowledge and
actionable insights from data across a broad range of application domains.
• Python is widely used for performing different data science operations on datasets like create, read,
update, delete (CRUD), visualize, etc.
Python: Versions
Python for data science
keras
sklearn
numpy
matplotlib
tensorflow
10. • Python offers many frameworks from which to choose from, including Bottle.py, Flask, CherryPy, Pyramid, Django and
web2py.
• These frameworks have been used to power some of the world's most popular sites such as Spotify, Mozilla, Reddit,
etc.
Python: Versions
Python for web application
11. • Python provides a built-in library called pygame, which used to develop the game.
• Pygame is a cross-platform library that is used to design video and browser games.
• We can use the pygame library to make games with attractive graphics and suitable animation.
Python: Versions
Python for game development
13. To download python, visit the following link:
Python: Installation
https://www.python.org/downloads/
14. Run the installer.
01
Make sure to select
“Add Python to
PATH” option on
bottom left corner
of the installer
window.
02
In case this option
was not selected, we
have to add path to
python installation in
PATH variable
manually.
03
Keep the default
values for the
remaining steps.
04
Python: Installation
15. • After installation is complete, to check the version of python installed on your system, use
“python --version” command in cmd window.
Python: Installation
“python --version” command in cmd window
16. • To write and execute python code in cmd, use “py”
Python: Installation
17. • An integrated development environment (IDE) is software for building applications that combines common
developer tools into a single graphical user interface (GUI).
• There are different types of IDEs like PyCharm, Visual Studio Code, etc.
• These IDEs are popularly used to develop complex applications in different frameworks.
• IDEs provide flexibility to use different programming languages like python, JavaScript, C++, etc.
Python: Integrated Development Environment (IDE)
18. To download PyCharm, visit the following link and click on download button:
Python: Pycharm IDE Installation
https://www.jetbrains.com/pycharm/
19. Python: Pycharm IDE Installation
Now, download community version installer by clicking download button below community.
20. Python: Pycharm IDE Installation
Run the PyCharm
installer.
01
Click next and you
can change the
destination folder
by clicking the
browse button.
02
Click on “create
desktop icon” button
and start installation
by clicking the install
button.
03
After installation,
click the finish
button.
04
21. • Visual Studio Code, also commonly referred as VS Code, is a source-code editor made by Microsoft
for Windows, Linux, and macOS.
• Features include support for debugging, syntax highlighting, intelligent code completion, snippets,
code refactoring, and embedded Git.
Python: Visual Studio Code
22. To download vs code, visit the following link and click on download button:
Python: Visual Studio Code Installation
https://code.visualstudio.com/download
23. Python: Visual Studio Code Installation
Run VScode
installer.
01
You can change
destination folder
for installation of
files.
02
Click “create desktop
icon” button.
03
Also, make sure
that you enable
“add to path” and
“Register code as
an editor for
supported files
type” button.
04
Then click on
next and install
button.
05
24. Create a file in vs code
with .py extension
Go to extensions > search
for “Python v2022.6.0” by
Microsoft.
Click install
Python: Visual Studio Code Installation
27. • Unlike other programming languages such as java, there is no need to write too much boilerplate
code in python.
• To print a string/message on the console window, print function is used.
Our first python program: hello world!
Python: Basics
28. • Write the code given in the image in a file.
• Save it by the name “demo.py”
• Files containing python source code are saved with .py extension
Python: Basics
Our first python program: hello world!
29. • To execute the code present in a file, use “py file-name.py” command in cmd window.
Python: Basics
Our first python program: hello world!
30. • Take a number input from user and then display that number in output.
User input in python
Python: Basics
31. • There is no keyword to declare variables in python.
• Variables are created by writing the name and assigning the values.
• A single variable can be used to store values of different types.
Variable
Python: Basics
32. • Take age input in years from user and then calculate this age in days by multiplying age by 365.
• Find error in this code below.
Python program for calculating age in days
Python: Basics
34. • Some of the data-types present in python are:
▪ str
▪ int, float, complex
▪ bytes,
▪ bool
▪ list, set, tuple, range, dictionary
Variables and data types
Python: Basics
Numeric Dictionary Boolean Set
Sequence
Type
Integer Float
Complex
Number
Strings Tuple
List
Python – Data Types
35. • To check the type of a variable in python, type() is used.
Data types
Python: Basics
Code Output
Important!
String in python can be written using “ ” as well as ‘ ‘
36. Line by line execution and errors in python
Python: Basics
• In python, execution happens line by line meaning that the execution of the python program will
happen from top to down.
• Whatever line you have written at the top will be executed first and the rest of the lines will be
executed sequentially.
• If you do not follow the python language instructions or if you make a mistake while writing the
code, then python will give you an error message in console.
37. Line by line execution and errors in python
Python: Basics
• An example to the errors and sequential programming is displayed below.
• In this example “variable1” at line number 3, a variable is declared; it is access at line number 2,
where an error is shown.
• The error has occurred only at line number 2, but not in line 3 and 4, which get executed after this
error. Execution was stopped at line number 2.
39. • Operators are used to perform operations on data, which is either received from user or manually
entered.
• The operators are divided into following groups:
▪ Arithmetic operators
▪ Assignment operators
▪ Comparison operators
▪ Logical operators
▪ Identity operators
Membership operators most commonly used operators that we will discuss here are Arithmetic,
Comparison, Assignment and Logical operators.
Operators
Python: Basics
40. Arithmetic operators
Python: Basics
Operator Name Example
+ Addition x + y
- Subtraction x - y
* Multiplication x * y
/ Division x / y
% Modulus x % y
** Exponentiation x ** y
// Floor division x // y
42. Assignment operators
Python: Basics
Operator Example Example same as below
= x = 5 x = 5
+= x += 3 x = x + 3
-= x -= 3 x = x - 3
*= x *= 3 x = x * 3
/= x /= 3 x = x / 3
%= x %= 3 x = x % 3
//= x //= 3 x = x // 3
**= x **= 3 x = x ** 3
44. Comparison operators
Python: Basics
Operator Name Example
== Equal x == y
!= Not equal x != y
> Greater than x > y
< Less than x < y
>=
Greater than or
equal to
x >= y
<=
Less than or
equal to
x <= y
46. Logical operators
Python: Basics
Operator Description Example
and
Returns True if both
statements are true
x < 5 and x < 10
or
Returns True if one of the
statements is true
x < 5 or x < 4
not
Reverse the result, returns
False if the result is true
not(x < 5 and x < 10)
49. Python is a programming language that was created by Guido van Rossum.
It was first released in 1991.
It is easy to learn and easy to code language.
Unlike other programming languages such as java, there is no need to write too much boilerplate
code in python.
Use of famous code editors like Visual Studio code, PyCharm etc.
Different operators in python include Arithmetic, Comparison, Assignment and Logical operators.
Summary
50. Python: MCQs
Q1. Main difference between python 2 and python 3
a) Print is a statement in python 2 and a function in python 3.
b) Python 2 is syntactically difficult than python 3.
c) Python 3 is not completely backward-compatible with python 2.
d) Python 3 has more usage than python 2.
e) None of the above
Q2. Predict output of code given below
a = 10
a = 20
a = 30
a = 40
print(a)
a) 10
b) 20
c) 30
d) 40
e) None of the above
51. Python: MCQs
Q3. Predict output of code given below
a = 30
b = 40
print(a */ b)
a) 1200
b) 0.75
c) Error message “invalid syntax”
d) 40
e) None of the above
Q4. Predict output of code given below
a = True
b = False
print((a and b) or a)
a) True
b) False
c) Error message “invalid syntax”
d) None of the above
52. Python: MCQs
Q5. Predict output of code given below
a = 30
b = 40
c = 60
d = 100
print( (a <= 30 and b <=60) and (c == 60 or d <= 200))
a) True
b) False
c) Error message “invalid syntax”
d) None of the above
Q6. Predict output of code given below
a = 20
b = 20
c = a*b
print()
a) 400
b) 20
c) Error message “print function empty”
d) No output
e) None of the above
53. Python: MCQs
Q7. Predict output of code given below
a = 30
b = 40
c = 60
d = 100
print( (a <= 30 and b <=60) or (c == 60 and d <= 200))
a) True
b) False
c) Error message “invalid syntax”
d) None of the above
Q8. Predict output of code given below
a = 50
b = 60
c = 2000
d = 100
print( (a <= 30 or b <=60) or (c == 60 or d <= 200) )
a) True
b) False
c) Error message “invalid syntax”
d) None of the above
54. Python: MCQs
Q9. Predict output of code given below
a = 2
a **= 3
b = 20
b /= 10
print(a**b)
a) 20
b) 64.0
c) Error message “invalid syntax”
d) None of the above
Q10. Predict output of code given below
a = 50
b = 100
c = 200
print((a < 1000 and b > 50) and c > 10)
a) True
b) False
c) Error message “invalid syntax”
d) None of the above