Data Types 03

Python Built in types:

Python is much extensive use due to ease of using its data-types compared to other programming languages. If we consider C# or Java, collection data-types are much hard to pen down while understanding and using at code.

Meet and Greet Built in types from Python:

Description for types are much detailed at Ref section link, get though it. I give simple statements for easy understanding and fast jump to next topics.

int(var, base=10) - This use base 10, which is specified to String, either is a numerical variable.


float(var_x) - Numerical consist of decimal point variable.


Sample with Errors:

Error-Code 02

str_vow = "AEIOU"
str_new = float(str_vow)
print(str_new)

O/P
..
ValueError: could not convert string to float: 'AEIOU'


Error-Code 03

i_new = "12345"
i_flow = float(number_new)
print(conver_flow)

O/P
..
12345.0


Why there is no Value Error for "12345" yet its a String. This is how python thinks !!
Let's look on some more E-Codes...
 
NextPage >> Standard Practise

Comments

Most popular

Learn Python Basics