1) Python is Interpreted Language ** - Line by Line the Code is been Executed
**2) Object Oriented Language - Supports Classes and Objects
3) Dynamically Type Language - Here we need not have to Define Datatype of Variable
4) Ease to Practice - Start this as First Language
*5) Scope of Python *- Python is used Everywhere in IT Industry
Python Example
print("Hello World")
print Statements print Default in New Line
Run this code saving the File using .py Extension
Variables - Variables are the Name given to Memory Location
- Variables names must start with a letter or an underscore. x = True # valid _y = True # valid 9x = False # starts with numeral => SyntaxError: invalid syntax $y = False # starts with symbol => SyntaxError: invalid syntax
- The remainder of your variable name may consist of letters, numbers and underscores. has_0_in_it = "Still Valid"
- Names are case sensitive. x = 9 y = X*5 =>NameError: name 'X' is not define
Global Variables
a = "good"
def test():
global a
b = "Omkar"
test()
print("python is " + a)
Inputs in Python are By Default Store as a String
Datatypes in Python
1) Numeric Datatype - int,float,Complex
2) Sequence Number - String,Char,List,Tuple
3) Dictionary,Set,Boolean
Examples on Datatype
# Integer
a = 3
type(a)
# Float
b = 4.5
print(b)
# Complex
h = 2j
print(h)
# String
p = "Python is Easy Lanuage"
print(p)
# Char
c = 'A'
print(c)
# List
l = [1,2,3,4,5,"python","Language"]
print(l)
print(type(l))
# Tuple
t = (1,2,3,4,5)
print(t)
# Dictionary
d = {1:"One",2:"Two",3:"Three"}
# Set
s = {2,2,2,2,2,234,,4,4,}
print(s)
Function
def test(a,b):
"""This is my Function for Addition"""
return a+b
# This is Doc String
Operators in python
1) Arithmetic Operator (+,-,/,*,//,%)
2) Comparison Operator(< , > , = , >= , <=)
3) Logical Operator (and , or , not)
4) Identity Operator()
5) Membership Operator
6) Bitwise Operator
`a = 5
b = 10
print("Value is ", a+b)
print("Value is ", a-b)
print("Value is ", a/b)
print("Value is ", a//b)
print("Value is ", a*b)
print("Value is ", a**b)
print("Value is ", a+b)
print("Value is ", a+b)`
Top comments (0)