Python is an interpreted, high-level, general-purpose programming language that is easy to learn and supports a wide variety of programming paradigms. It has a large standard library and is used for many types of applications. Python code is executed by an interpreter that translates Python code into bytecode that is run by the Python virtual machine. The most common way to run Python code is through Python scripts, but it can also be run interactively through the Python shell or within integrated development environments. Indentation through whitespace is significant in Python to denote code blocks rather than brackets or parentheses as in other languages.
Gen AI in Business - Global Trends Report 2024.pdf
Welcome to Python Programming.pptx
1. Welcome to Python Programming
Simple, Easy to learn and most demanded
language across the world.
2. What is Python?
•Python is an interpreted & high-level programming language.
•Development started in the 1980’s by Guido van Rossum.
• Only became popular in the last decade or so.
• Python 3.x currently dominates, and Python 2.x is the past of
Python.
•Supports a multitude of programming paradigms.
• OOP, functional, procedural, logic, structured, etc.
• General purpose.
• Very comprehensive standard library includes numeric
modules, crypto services, OS interfaces, networking
modules, GUI support, development tools, etc.
3. Why to Learn Python?
Wait! I can do all these things using
other programming languages too! Then
why Python?
4. Impression
•Easy to learn.
• Supports quick development.
• Cross-platform.
• Open Source.
• Extensible.
• Embeddable.
• Large standard library and active community.
• Useful for a wide variety of applications.
5. How it Works?
•Compiler or Interpreter?
•The standard implementation of Python is interpreted.
• The interpreter translates Python code into bytecode,
and this bytecode is executed by the Python VM
(similar to Java).
• Two modes: normal and interactive.
• Normal mode: entire .py files are provided to the
interpreter.
• Interactive mode: read-eval-print loop (REPL) executes
statements piecewise.
6. Hello World Program
C Language
// Your First C Program
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
Java Language
// Your First Java Program
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Python Language
#Your 1st Python Program
print(“Hello World”)
7. Which Version to follow?
• F1: Division operator Eg. -7 / 5
• F2: I/O functions
• F3: str type
• F4: xrange() saves memory but doesn’t support
slicing
• F5: Error Handling
try:
trying_to_check_error
except NameError, err:
print err, 'Error Caused' # Would not work in
Python 3.x
• F6: modules
Python 3.10.0b4 is available". 10 July 2021.
BUT still the stable version is 3.9
8. 1. Python Shell: An interactive interpreter. It
is pre available in Linux and Mac OS X
2. Script mode on cmd
3. IDE: Atom, IDLE , Jupyter, Spyder, etc.
Find out more at the PowerPoint Getting Started Center
Modes of running a Python Code
.py
Python
Shell
IDE
Script
mode
9. Some Fundamentals
• Whitespace is significant in Python. Where
other languages may use {} or (), Python uses
indentation to denote code blocks.
• Comments
• Single-line comments denoted by #.
• Multi-line comments begin and end with three “s.
• Typically, multi-line comments are meant for
documentation.
• Comments should express information that
cannot be expressed
in code – do not restate code.
# here’s a comment
for i in range(0,3):
print (i)
def myfunc():
"""here’s a comment about the
myfunc function”””"""
print(“I'm in a function!“)