Programming: General
0 1 2 3
x = 'abcd' for i in range (len(x)): print(i)
ABCD
x = 'abcd' for i in x: print(i.upper())
4
x<<2
True
z=set('abc$de')
built- in function & user defined function
two main types of functions in python
Object oriented structured programming functional programming
types of programming that python supports
unlimited length
variable names in python
sys.version(1)
which of the ff. function can help us to find the version of python that we are currently working on?
Indentation
which of the following is used to define a block of code in python language?
[4, 3]
1. >>>list = [1, 3] 2. >>>list2 = list1 3. >>>list1[0] = 4 4.>>>>print(list2)
True
1. d = {"john":40, "peter":45} 2. "john" in d
7
4 + 3 % 5
A[1][2]
A = [[1, 2, 3,], [4, 5, 6,], [7, 8, 9,]]
preferred installer program
PIP stands for python
Guido van Rossum
The developer of Python.
"john" and "peter"
d = {"john": 40, "peter":45}
any number of
def f(x): def f1 (*Sanfoundry") return x(*args, **kwargs) return f1
0, 1, 2
i = 0 while i < 5: print (i) i + = 1 if i ==3: break else: print(0)
error
i = 1 while true: if i%3 ==0: break print(i) i + = 1
python code is neither compiled nor interpreted
is python code compiled or interpreted
Class
not a core data type in python prog.
PEMDAS
order precedence in python
9.0
print (math.pow(3,2))
56.24
print("%.2f"%x)
hello foo and bin
print("Hello {0[0]} and {0[0]}".format(('foo', 'bin')))
lambda
python supports the creation of anonymous functions at runtime, using a construt called
(1,2,3) -represented by round bracketd
python tuple
5
round(4.576
in python id function returns the identity of the object
the use of id() function in python?