Category: Python
Keyword Arguments in Python
This tutorial will teach you about Python keyword arguments and how to use them to make function calls more visible. Let’s begin with a basic method for calculating the net price from the selling price and discount: The price and discount parameters are passed to the get net price() function. The following example explains how to use the get net price() function to get the…
Python Syntax
This lesson will teach you the fundamentals of Python syntax so you can get started quickly with the language. Whitespace and indentation If you’ve worked with other programming languages like Java, C#, or C/C++, you’re aware that semicolons (;) are used to separate statements. Python, on the other hand, constructs the code structure using whitespace and indentation. A piece of Python code is shown below:…
break statement in Python
This tutorial will teach you how to use the Python break statement to exit a loop prematurely. You may want to end a for loop or a while loop early regardless of the results of the conditional tests. In these cases, the break statement can be useful: To end a loop when a condition is True, you typically use the break statement in conjunction with…
Python Program to Generate Random Number
This program demonstrates how to generate random number in python using the randint method. How to generate random number in Python? Inorder to generate random number in Python, you will need to use the randint() function which is defined in the random module() in python. Output 7 Everytime when the randint function is called , it generates a different output as it is printed.
Python Program to Print Fibonacci Series
In this Python program, you will learn how to generate and print Fibonacci series using loops and conditional statements. What is a Fibonacci Sequence ? A Fibonacci sequence is an sequence of integers where the value of the sequence is determined by adding the preceding two values. The first two values in the sequence is 0 and 1. Then comes Next one with (N-1) +…
pass statement in Python
In this tutorial, you’ll learn how to use the Python pass statement as a placeholder. Consider the following if/else condition: You don’t have any code in the else clause yet. This else clause, however, will be coded later. If you run the code in this situation, you’ll get a syntax error (SyntaxError). The Python pass statement is useful in this situation: The statement pass has…
Numbers in Python
This tutorial will teach you about Python numbers and how to use them in your programs. Python various various data types like integers, floats, and complex numbers. This tutorial only covers integers and floats. Integers Integers are numbers with the type int, such as -1, 0, 1, 2, 3,… Math operators such as +, -, *, and / can be used to create expressions that…
Python Program to Compute Quadratic Equation
This Python program demonstrates how you can compute Quadratic Equation using a Python program when the co-efficients are defined. The Formula for the Quadratic Equation in Standard Form is ax2 + bx + c = 0 a,b,c are real numbers and A is not equal to zero. How to Compute Quadratic Equation in Python ? Output (-1.25-1.5612494995995996j) and (-1.25+1.5612494995995996j) Following are the steps that we…
while loop in Python
This tutorial will teach you how to utilise the Python while statement to run a code block as long as a condition is true. While in Python, if a condition is True, you can run a code block repeatedly. The Python while statement is shown in the following syntax: The condition is a boolean expression that returns True or False when evaluated. At the start…
Tuples in Python
This tutorial will teach you about Python tuples and how to use them effectively. You may want to make a list of elements that cannot be altered at any moment during the programme. Tuples make this possible. A tuple is a list that is immutable. Immutable is a Python term for a value that cannot change. A tuple is an immutable list by definition. How…
Type Conversion in Python
This tutorial will teach you about type conversion in Python as well as some useful type conversion functions. The input() function is used to obtain user input. As an example: When you run this code, the Terminal will prompt you for the following input: If you enter a value, such as a number, the programme will display that value back to you: The input() function,…