Datatype decides at Compile time.
Datatype decides at Execution time.
int a = 5;
int a
a = 5;
a = 5;
Open Source
Community support
Web development (Django)
Data science (Machine learning, AI)
Automation
GUI Programming
& its F**k easy
WHERE DO, WE RUN PYTHON PROGRAMMES
Command prompt, Terminal
Or IDE (PyCharm, PyDev etc)
Open Cmd Or Terminal
print "HELLO, WORLD!"
hello.py
Numbers
String
List
Tuple
Dictionary
list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]
tinylist = [123, 'john']
#print
print list
Read-only
tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )
tinytuple = (123, 'OM')
tuple = ( 'abcd', 786 , 2.23, 'OM', 70.2 )
list = [ 'abcd', 786 , 2.23, 'OM', 70.2 ]
tuple[2] = 1000 # Invalid syntax with tuple
list[2] = 1000 # Valid syntax with list
# empty dictionary
my_dict = {}
# dictionary with integer keys
my_dict = {1: 'apple', 2: 'ball'}
# dictionary with mixed keys
my_dict = {'name': 'John', 1: [2, 4, 3]}
# using dict()
my_dict = dict({1:'apple', 2:'ball'})
# from sequence having each item as a pair
my_dict = dict([(1,'apple'), (2,'ball')])
Creating a dictionary is as simple as placing items inside curly braces {} separated by the comma.
An item has a key and the corresponding value expressed as a pair, key: value.
#only for strings
username = raw_input('What is your name? ')
#all types except string
myage = input("What is your age? ")
Two types - input() and raw_input()
Defining a function
Passing arguments
Returning from a function
Calling a function
Defining a function
def function_name():
print("fuck our funtion is working")
Passing Arguments
function_name(4,6)
Returning from a function
def fun(a, b):
sum=a+b
return sum
#OR
def fun(a, b):
return a + b
Calling Statement
def fun(a, b):
return a + b
x=fun(3, 6)
#x holds value returned by function
class class_name:
something="lol"
Instance objects
instance = class_name()
instance.something
Try this