EH#4: Understanding the LPDDR4 SDRAM memory for mobile, automotive and embedded system applications.
EH#4: Understanding the LPDDR4 SDRAM memory for mobile, automotive and embedded system applications.
- Get link
- X
- Other Apps
a,b,c,d,e = 10,20,30,40,50 //valid in python but not in c/c++/java
type(a) // to check the type of var a
def f1(): print("Good Evening") //defining a function f1()
f1() //output: Good Evening
x=10 if a>b else 20 //valid in python
for i in range(10):
print(i)
print "hello" //valid in python2 but not in python3
print("hello") // for python3
Long data type is not present in Python3 but is was there in Python2.cash = 10 //valid
ca$h = 10 //not valid
total123 = 10 //valid
123total = 10 //not valid
total = 10 //valid
TOTAL = 10 //valid
if = 10 //not valid
def = 20 //not valid
_x //way to declare private variable
__x //way to declare strongly private variable
__add__ //language specific identifier
import keyword
keyword.kwlist
x = 10 //here x is of type int, because x is going to store an int data
y = 10.123 //here y is of type float
z = 10+2j //here z is of type complex
a = 10
id(a) //it gives the address of the object a targeting to
a = 1111 //decimal way
print(a) //1111
a = 0b1111 or 0B1111 //binary way
print(a) //15
a = -0B1111
print(a) //-15
a = 777
print(a) //777
a = 0o777 or 0O777 //octal way
print(a)
a = 0O1111
print(a) //585
a = 0xFace or 0XFace //hexadecimal way
print(a) //64204
a = 0xBeef
print(a) //48879
a = 0xBeer //invalid (think why so?)
bin(15) // 0b1111
bin(0o777) // 0b111111111
bin(0x123) // 0b1001000110100
oct(786) // 0o1422
oct(0xface) // 0o175316
oct(0B11111) // 0o37
hex(10) // 0xa
hex(16789) // 0x4195
f = 123.456 // allowed
f = 0x123.456 // not allowed
f = 0o123.456 // not allowed
f = 1.2e3
print(f) // output: 1200.0
f = 1.2e100
print(f) //output: 1.2e+100
x = 10+20j
print(x) //10+20j
type(x) //complex
x=10+j20 //syntax error
a = 10+20j
b= 20+30j
print(a+b) //30+50j
print(a*b) //-400+700j
print(a.real) //10.0 why float not int (think): because in python real and imag part of a complex number is treated as float by default
print(a.imag) //20.0
x1 = 10
x2 = 20
c = x1>x2
print(c) //False
//Things to remember
// True + True = 2
// True + False = 1
// True / True = 1.0 //flaoting point result: because in python division operator is only defined for floating values.
// True / False //invalid: divisible by zero
//way to write an string
a = asif //here asif is not an string
a = 'asif' //string
a = "asif" //string
b = 2 //here 2 is an int
b = '2' //here 2 is an string, now we can say that there is no char data type in python.
b = "2" //here 2 is an string
//Always remember that if we print an string
//it will always be printed in single quotes by python
a ="shoaib"
print(a) //'shoaib'
a = 'asif'
print(a) //'asif'
a = "asif nazeer" //allowed
a = "asif
nazeer" //not allowed this way: use triple single quotes or triple double quotes
a = """asif
nazeer""" //allowed
a = '''asif
nazeer''' //allowed
print(a) //'asif
//nazeer'
s = "Durga"
//-5 -4 -3 -2 -1
//D u r g a
//0 1 2 3 4
print(s[0]) //D
//now print function is omitted
s[2] //'r'
s[-3] //'r'
s[-1] //'a'
s[10] //error (think why?)
s[1:4] //'urg'
s[2:4] //'ur'
s[1:] //'urga', if end value is not given python assumes this value as end value bydefaul
s[3:] //'ga'
s[:4] //'durg', if begin value is not given python assumes this values as begin by default
s[:] //'Durga', because python assumes end and begin values
s[-1:-4] //nothing in the output, because begin index is higher than the end
s[-4:-1] //'urg'
s[100] //error
s[1:100] //'urga' (why?) lets understand
//var[begin:end:step] here by default step value is 1
//in the prev example end is 100 and begin is 1
//so it will print from 1 to end-1 with step=1
//if there is no character upto given end index
//then it will return upto what index is available
s = "aligarh Muslim University"
s[1:10] //'ligarh Mu'
s[1:10:2] //'lgr u'
s = "AMU"
print(s*3) //'AMUAMUAMU'
print(len(s)) //3
print(int(123.456)) //123
//now print is omitted
int(10+20j) //can't convert complex to int
int(True) //1
int(False) //0
int("10") //10
int("10.5") //not allowed, because python will think that the data is being converted
//from string to int but inside string its a float value
//Remeber string containing int decimal is only allowed
int("1111") //1111
int("0B1111") //not allowed
//for float(): only int decimal and float inside string is allowed
float(10) //10.0
float(10+20j) //not allowed
float(True) //1.0
float(False) //0.0
float("10") //10.0
float("10.5") //10.5
float("ten") //not allowed
float("0b1111") //not allowed
//complex(): cannot take the second argument if first one is string
complex(10) //10+0j
complex(10.5) //10.5+0j
complex(True) //1+0j
complex(False) //0j, remember when both x,y are zeros
complex("10") //10+0j
complex("10.5") //10.5+0j
complex("ten") //not allowed
complex("0b1111") //not allowed
complex(10,20) //10+20j
complex(True,False) //1+0j
complex(10,20.5) //10+20.5j
complex("10","20") //not allowed because complex function cannot take the second argument
//first argument is string
bool(0) //False
bool(10) //True
bool(0.0) //False
bool(0.8) //True
bool(2.8) //True
bool(10+20j) //True
bool(0+0j) //False
bool('') //False
boo(' ') //True, because there is an space
//remember for bool funcion only 0+0j and empty strings are False and everything else is true
//str() : takes anything as input: no restriction
str(10+20j) //'10+20j'
str(True) //'1'
str(False) //'0'
str(0) //'0'
str(20.0) //'20.0'
Comments
Post a Comment