DataTypes in Python

DataTypes in Python 

  1.  str (T) -> str returns string showing literal (possible signed for numeric types)
  2. int (T) -> int returns 0 for False, 1 for True; truncated float; truncated real–part of complex
  3. float (T) -> float returns 0.0 for False, 1.0 for True; equivalent for int; real–part for complex
  4. complex (T) -> complex returns (0+0j) for False, (1+0j) for True; equivalent int and float
  5. bool (T) -> bool False for empty string and zero value, True for non–empty string and non–zero value

Examples of operators

a%b = a - b*(a//b) 
bool('False') =True
12//5 is same as math.floor(12/5)
math.floor(-1.5)=??
int(-1.5)=??
print('Hitesh','Vataliya')=??
print('Hitesh'+'Vataliya')=??
print(5*'Hitesh')

Comments

Popular posts from this blog

Testing in Python and types of software testing

Comparison Operator in Python

First Program in Python