Numbers in Python (Int, Float, Complex, Boolean) - Python Data Types - Python Tutorial for Beginners

Veröffentlicht am: 29 Januar 2021
auf dem Kanal: Digital Academy
1,151
21

🎓 Welcome back to Digital Academy, the Complete Python Development Tutorial for Beginners, which will help you Learn Python from A to Z!

🖥️ Numerical Data Types in Python

In Python, numeric data type represent the data which has numeric value. Numeric value can be: Integer or Floating numbers, even Complex numbers. These values are defined as int, float and complex class in Python. We can use the type() function, to know which class a variable or a value belongs to. And the isinstance() function, to check if an object belongs to a particular class. You can convert from one type to another with the int(), float(), and complex() methods.

○ Integers

This value is represented by int class. It contains positive or negative numbers (without fraction or decimal). In Python 3, Integers can be of any length, it is only limited by the amount of memory your system has, as are all things. But beyond that, an integer can be as long as you need it to be.

Python interprets a sequence of decimal digits without any prefix to be a decimal number. But the following strings can be prepended to an integer value, to indicate a base other than 10:

Prefix Interpretation Base
0b (zero + lowercase letter 'b') Binary 2
0o (zero + lowercase letter 'o') Octal 8
0x (zero + lowercase letter 'x') Hexadecimal 16

○ Floating point Numbers

This value, represented by float class, designates a floating-point number. It is a real number, with the floating point representation, and is specified with a decimal point. Optionally, the character 'e', followed by a positive or negative integer, may be appended, to specify the scientific notation. This representation is accurate up to 15 decimal places.

○ Complex Numbers

Complex Numbers, represented by complex class, is written in the form, (real part) + (imaginary part)j. It is stored internally, using either rectangular or Cartesian coordinates. It can be very useful if you are studying or working with mathematical functions, or in engineering. For example: 2+3j

○ Boolean Values

Python 3 provides a Boolean data type. Objects of Boolean type may have one of two values, True or False.

In programming you often need to know if an expression is True or False. You can evaluate any expression in Python, and get one of these two answers. For instance, when you compare 2 values, the expression is evaluated, then Python returns the Boolean answer. The same behaviour occurs, when you run a condition in an if statement.

Python also has many built-in functions that returns a boolean value, like the isinstance() function, which can be used to determine if an object is of a certain data type. You will learn more about evaluation of objects in the Boolean context, when you encounter logical operators, in the upcoming tutorial on operators, and expressions in Python.

Let's play this video, stick around and watch until the end of this video! 👍🏻

- Digital Academy™ 🎓

***

☞ WATCH NEXT:
○ Data Types in Python -    • DATA TYPES in Python (Numbers, String...  
○ Operators in Python -    • OPERATORS in Python (Arithmetic, Assi...  
○ IF Statements in Python -    • CONDITIONAL Statements in Python (IF,...  
○ FOR Loops in Python -    • FOR Loop in Python (Syntax, Break, Co...  

📖 Blog: http://digital.academy.free.fr/blog

📖 [FULL Course] HOW TO Learn Python? Python Tutorial for Beginners:    • 🐍 Python 101: Learn Python Basics for...  

📖 [PLAYLIST] Complete Python Development Course for Beginners: http://digital.academy.free.fr/playli...

🧑‍🎓 [COURSE] Python for Absolute Beginners: http://digital.academy.free.fr/courses

📘 [BOOK] Python for Absolute Beginners: https://amzn.to/3NvyOWV

🛒 Shopping and Discounts: http://digital.academy.free.fr/store

💌 Weekly Newsletter for Developers: https://www.getrevue.co/profile/digit...

#Python #Tutorial #Beginners #Shorts

***

♡ Thanks for watching and supporting ♡
Please Subscribe. Hit the notification bell.
Like, Comment and Share.

***

♡ FOLLOW US ♡
✧ http://digital.academy.free.fr/
✧   / digitalacademyy  
✧   / digitalacademyfr  
✧   / digital_academy_fr  
✧    / digitalacademyonline  

♡ SUPPORT US ♡
✧ http://digital.academy.free.fr/join
✧ http://digital.academy.free.fr/store
✧ http://digital.academy.free.fr/donate
✧ http://digital.academy.free.fr/subscribe
✧   / digital_academy  
✧ https://www.buymeacoffee.com/digital_...

***


Auf dieser Seite können Sie das Online-Video Numbers in Python (Int, Float, Complex, Boolean) - Python Data Types - Python Tutorial for Beginners mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Digital Academy 29 Januar 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,151 Mal angesehen und es wurde von 21 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!