Posts

#19 Python Tutorial for Beginners | If Elif Else Statement in Python

  #19 Python Tutorial for Beginners | If Elif Else Statement in Python Welcome back .! My name is Ivan 20 and let's continue this series on Python. In this video, we'll talk about the CPU. CPU Overview The CPU has three parts: CU - Control Unit MU - Memory Unit ALU - Arithmetic and Logical Unit Working with the MU The MU, or Memory Unit, is used to store data when working with variables. Working with the ALU The ALU, or Arithmetic and Logical Unit, has two parts: AU - Arithmetic Unit LU - Logical Unit The AU performs calculations such as addition, subtraction, multiplication, and division. The LU is responsible for making decisions based on conditions. Working with the LU The LU, or Logical Unit, allows your computer to make decisions based on certain conditions. In programming, we use the "if" statement to specify the flow of execution based on conditions. Using the "if" Statement The syntax of the "if" statement is as follows: if condition: # ...

#16 Python Tutorial for Beginners | Import Math Functions in Python

  #16 Python Tutorial for Beginners | Import Math Functions in Python Mathematical Functions in Python Welcome back! In this lesson, we will be exploring mathematical functions in Python. These functions allow us to perform various mathematical operations easily. Let's dive in! Finding Square Roots To find the square root of a number, we can use the built-in  sqrt  function from the  math  module. For example, to find the square root of 25, we can write: x = math.sqrt(25)print(x) This will output  5.0 , which is the square root of 25. The  float  and  ceil  Functions The  float  function converts a number to a floating-point value, while the  ceil  function rounds a number up to the nearest integer. For example: value = 2.5rounded = float(value)print(rounded)value = 2.1rounded = math.ceil(value)print(rounded) The output of the above code will be: 2.03 The  power  Function The  power  function allow...

#15 Python Tutorial for Beginners | Python BitWise Operators

  #15 Python Tutorial for Beginners | Python BitWise Operators Welcome, and in this series on Python, we will be focusing on bitwise operators. Bitwise operators are used to manipulate binary numbers, which can be useful when working with money formats or other applications. Let's dive right in! The Complement Operator (~) The tilde (~) symbol is used to represent the complement operator in Python. The complement of a binary number is obtained by flipping all the bits (0s become 1s and 1s become 0s). For example, the complement of 12 is -13. Example: ~12 = -13 To understand why the complement of 12 is -13, we need to understand the concept of two's complement. In computer systems, negative numbers are stored in two's complement form. To find the two's complement of a number, we find the one's complement (flip all the bits) and then add 1 to the result. Example: 12 in binary: 1100Complement of 12: 0011Two's complement of 12: 1101 (which is -13 in decimal) Try dif...