Py Lecture-1
Py Lecture-1
Py Lecture-1
1. Python was developed by Guido van Rossum in the early 1990s and its latest version is
3.12.3, we can simply call it Python3.
2. Python is a high-level, general-purpose and very popular programming language.
3. Python programming language (latest Python 3) is being used in web development
and Machine Learning applications along with all cutting-edge technology in
Software Industry.
4. Python language is being used by almost all tech-giant companies like – Google,
Amazon, Facebook, Instagram, Dropbox, Uber… etc.
Setting up Python
4 + 5 + 6 + \
7 + 8 + 9
'NEYMAR',
'SUAREZ']
Declared using braces {} :
x = {1 + 2 + 3 + 4 + 5 + 6 +
7 + 8 + 9}
# Python indentation
A = 'abc'
if A == 'abc':
print('Logging on to python.org...')
else:
Output
Logging on to python.org...
All set !
● What are Comments in Python?
# This is a comment
print("Hello World")
B. Multiline comment in Python
# This is a comment
print("Hello World")
print("Hello World")
Python | Set 2 (Variables, Expressions, Conditions and
Functions)
Program-:
print ("Hello World") # Notice that NO semi-colon is to be used
Variables in Python
a=3
A=4
print (a)
print (A)
Expressions in Python
Note:
Conditional output in python can be obtained by
using if-else and elif (else if) statements.
a=3
b=9
if b % a == 0 :
print ("b is divisible by a")
elif b + 1 == 10:
print ("Increment in b produces 10")
else:
print ("You are in else statement")
Functions in Python
if a % b == 0 :
else:
checkDivisibility(4, 2)