Category Archives: Python Programming Language

Python Convert Binary Number to Decimal

Python Convert Binary Number to Decimal – This Python tutorial gives the basic logic to convert a binary number into its corresponding decimal number. The image number 1 shows the whole binary to decimal number conversion process . The Python source code to convert a binary number into decimal # This Python script / program… Read More: Python Convert Binary Number to Decimal »

Loading

Python Ternary Operator or Conditional Expressions

Python Conditional Expression is also called Ternary Operator. It is an alternative to a simple Python if else statement. Syntax of Python Ternary Operator or Conditional Expressions x  if   C   else   y Where x is a simple Python expression or statement. The C represents a given condition. The y represents another simple… Read More: Python Ternary Operator or Conditional Expressions »

Loading

Python for Loop Syntax Plus Examples

Python for loop Statement Syntax Plus Examples – This is a Python tutorial to explain the syntax and use of for loop with different practical examples in Python scripts. Python for Statement We can use a Python for statement for two main puposes: Use a for loop to iterate over items in a sequence Using… Read More: Python for Loop Syntax Plus Examples »

Loading

Python User Defined and Built-in Functions – Defining and Using Functions

‘Python User Defined and Built-in Functions – Defining and Using Functions’ is our Python tutorial to explain the use of Python functions in Python programs / scripts. We will cover the following topics on Python Functions: Python Functions Defining and Using Functions What is a Function? Importance of Functions Advantages of  Using Functions Types of… Read More: Python User Defined and Built-in Functions – Defining and Using… »

Loading

Python Variable Names and Naming Rules

Python Variable Names and Naming Rules is a Python tutorial to explain the rules and importance of choosng good names for your variables in a program. Choose Short but Meaningful Variable Names Python Variable names shoud be short but meaningful. It will add in program readability. For example, ‘num’ is a better variable name than… Read More: Python Variable Names and Naming Rules »

Loading

Python Math Operators

Python Math Operators are the special symbols to perform common mathematical operations on data called operands. The Math operators include the following: Table Explaining the Use of Python Math Operators Math Operator Used for Example Result + Addition 2+9 11 – Subtraction 9-2 7 * Multiplication 7*5 35 / Division 7/2 3.5 // Integer Division… Read More: Python Math Operators »

Loading

Python if elif else Statement with Example Programs

Python if elif else Statement decides to select only one block of statements from many given block of statements. It selects a block on the basis of the condition related to that block. It means that if elif else statement has many conditions and corresponding blocks of statements. If a given condition is true, if… Read More: Python if elif else Statement with Example Programs »

Loading