Category: New Python tutorial

python tutorials and learn python

Created with Sketch.

Python Functions

Python Functions Summary: in this tutorial, you’ll learn to develop Python functions by using the def keyword. What is a function A function is a named code block that performs a job or returns a value. Why do you need functions in Python Sometimes, you need to perform a task multiple times in a program.…
Read more

Python pass

Python pass Summary: in this tutorial, you’ll learn how to use the Python pass statement as a placeholder. Introduction to the Python pass statement Suppose that you have the following if…else statement: counter = 1 max = 10 if counter <= max: counter += 1 else: # implement later Code language: Python (python) In the…
Read more

Python continue

Python continue Summary: in this tutorial, you’ll learn about the Python continue statement and how to use it to control the loop. Introduction to the Python continue statement The continue statement is used inside a for loop or a while loop. The continue statement skips the current iteration and starts the next one. Typically, you…
Read more

Python break

Python break   Summary: in this tutorial, you’ll learn about the Python break statement and how to use it to exit a loop prematurely. Introduction to the Python break statement Sometimes, you wan to terminate a for loop or a while loop prematurely regardless of the results of the conditional tests. In these cases, you…
Read more

Python while

Python while Summary: in this tutorial, you’ll learn about the Python while statement and how to use it to run a code block as long as a condition is true. Introduction to the Python while statement Python while statement allows you to execute a code block repeatedly as long as a condition is True. The…
Read more

Python for Loop with Range

Python for Loop with Range Summary: in this tutorial, you’ll learn about the Python for loop and how to use it to execute a code block a fixed number of times. Introduction to Python for loop statement with the range() function In programming, you often want to execute a block of code multiple times. To…
Read more

Python Ternary Operator

Python Ternary Operator   Summary: in this tutorial, you’ll learn about the Python ternary operator and how to use it to make your code more concise. Introduction to Python Ternary Operator The following program prompts you for your age and determines the ticket price based on it: age = input(‘Enter your age:’) if int(age) >=…
Read more

Python if Statement

Python if Statement   Summary: in this tutorial, you’ll learn how to use the Python if statement to execute a block of code based on a condition. The simple Python if statement You use the if statement to execute a block of code based on a specified condition. The syntax of the if statement is…
Read more

Python Logical Operators

Python Logical Operators Summary: in this tutorial, you’ll learn about Python logical operators and how to use them to combine multiple conditions. Introduction to Python logical operators Sometimes, you may want to check multiple conditions at the same time. To do so, you use logical operators. Python has three logical operators: and or not The…
Read more

Python Comparison Operators

Python Comparison Operators Summary: in this tutorial, you’ll learn about Python comparison operators and how to use them to compare two values. Introduction to Python comparison operators In programming, you often want to compare a value with another value. To do that, you use comparison operators. Python has six comparison operators, which are as follows:…
Read more