Posts

#12 Python Tutorial for Beginners | Number System Conversion in Python

  #12 Python Tutorial for Beginners | Number System Conversion in Python Binary Formats in Python Welcome back, aliens! My name is Naveen Ready and in this blog post, we'll continue our series on Python by discussing binary formats. In the programming world, we commonly work with decimal and binary systems. However, there are two other number systems that we use: octal and hexadecimal. In this post, we'll learn how to convert numbers from one system to another using Python. Converting Decimal to Binary Let's start by understanding how to convert a decimal number to binary. To do this, we can use the  bin  function in Python. The base of the decimal system is 10, while the base of the binary system is 2. In the decimal system, we have 10 digits (0-9), whereas in the binary system, we only have 2 digits (0 and 1). For example, let's convert the number 25 to binary. By using the  bin  function, we can easily get the binary format of 25, which is  0b11001 . But...

#11 Python Tutorial for Beginners | Operators in Python

  #11 Python Tutorial for Beginners | Operators in Python Working with Operators in Python Welcome back! In this video, we'll be discussing different types of operators in Python, including: Arithmetic Operators Assignment Operators Unary Operators Relational Operators Logical Operators Arithmetic Operators We're already familiar with arithmetic operators, such as addition, subtraction, multiplication, and division. We can use variables to perform these operations, like: x = 2y = 3x + y # Output: 5x - y # Output: -1x * y # Output: 6x / y # Output: 0.6666666666666666 We can also use the modulo operator (%) to get the remainder of a division: x % y # Output: 2 Assignment Operators We use the assignment operator (=) to assign values to variables: x = 8 We can also use shorthand notation to perform an operation and assign the new value to the variable: x += 2 # Same as x = x + 2 We can use the same shorthand notation for subtraction, multiplication, and division: x -= 3 # Same as x...