Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for INT FLOAT COMPLEX - PYTHON
Sakshi
Sakshi

Posted on

     

INT FLOAT COMPLEX - 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.

Image description

We have the following data types in python :

Text Type:  strNumeric Types:  int, float, complexSequence Types: list, tuple, rangeMapping Type:   dictSet Types:  set, frozensetBoolean Type:   boolBinary Types:   bytes, bytearray, memoryviewNone Type:  NoneType
Enter fullscreen modeExit fullscreen mode
  1. Numeric Types
  • Integers – This value is represented byint class. It contains positive or negative whole numbers (without fractions or decimals). In Python, there isno limit to how long an integer value can be.

  • Float – This value is represented by thefloat 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

Image description

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 writinghelp(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.

Image description

Thanks for reading guys

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

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Loves programming! Web Dev Enthusiast. Getting my hands dirty with ANGULAR. Available for hire
  • Location
    India
  • Education
    Undergraduate | Geek
  • Joined

More fromSakshi

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp