INT FLOAT COMPLEX – PYTHON

Python Unleashed (12 Part Series)

1 Membership Operators in Python
2 PASS With IF ELSE In PYTHON
8 more parts…
3 Match Case Super Powers – Python
4 What You Need To Know About Conditional Statements In Python ?
5 Mastering Strings – Python
6 LOOPS – FOR LOOP
7 INT FLOAT COMPLEX – PYTHON
8 List Data Structure in 5 mins – Python
9 TUPLES in 3 minute – Python
10 Settling with SETS – Python
11 Settling with Sets 2.0 – Python
12 Dictionary – Python

Good day geeks!

PYTHON UNLEASEH’D 06

This mediocre sounding blog is going to be interesting unlike its name I swear. No already known information here, not discussing basics, just (RARELY KNOWN) things for people shifting to python.

We have the following data types in python :

Text Type:  str
Numeric Types:  int, float, complex
Sequence Types: list, tuple, range
Mapping Type:   dict
Set Types:  set, frozenset
Boolean Type:   bool
Binary Types:   bytes, bytearray, memoryview
None Type:  NoneType

Enter fullscreen mode Exit fullscreen mode

  1. Numeric Types
  • Integers – This value is represented by int class. It contains positive or negative whole numbers (without fractions or decimals). In Python, there is no limit to how long an integer value can be.

  • Float – This value is represented by the float class. It is a real number with a floating-point representation. It is specified by a decimal point.

Optionally, the character e or E followed by a positive or negative integer may be appended to specify scientific notation.

  • Complex Numbers – A complex number is represented by a complex class. It is specified as (real part) + (imaginary part)j. For example – 2+3j

Program for complex numbers

AS MENTIONED, ONLY ‘j/J’ is allowed to represent imaginery part of complex number. Please try in your editor.

Python has class for each data type, as read above. Okay

I guess there must be some methods associated with each class. Lets search about this and explore.

FROM STACKOVERFLOW –

int is a class. The type of a class is usually type.

And yes, almost all classes can be called like functions. You create what’s called an instance which is an object that behaves as you defined in the class. They can have their own functions and have special attributes.

(type is also a class if you’re interested but it’s a special class. It’s a bit complicated but you can read more on it if you’ll search for metaclasses)

We get plethora of methods and information🤯 about this ‘int’ class on writing help(int) in notebook. That’s more than enough, lets wrap up🤐. These numeric types are associated with their respective classes and what all variables we create are instances. These classes have methods.

A good read on numeric data types of Python

We can use underscore as separators for big integer values like we use comma in maths.

Thanks for reading guys

If you liked the content, do react, or for any feedback/correction/suggestion feel free to reach out to me on Linkedin or can comment here…

Python Unleashed (12 Part Series)

1 Membership Operators in Python
2 PASS With IF ELSE In PYTHON
8 more parts…
3 Match Case Super Powers – Python
4 What You Need To Know About Conditional Statements In Python ?
5 Mastering Strings – Python
6 LOOPS – FOR LOOP
7 INT FLOAT COMPLEX – PYTHON
8 List Data Structure in 5 mins – Python
9 TUPLES in 3 minute – Python
10 Settling with SETS – Python
11 Settling with Sets 2.0 – Python
12 Dictionary – Python

原文链接:INT FLOAT COMPLEX – PYTHON

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容