Category: Python

Lambda Expressions in Python

This tutorial will teach you about Python lambda expressions and how to use them to write anonymous functions. Sometimes you’ll need to write a single-expression function. This function, however, must only be used once. It will also be obsolete to use the def keyword to declare that function. Python lambda expressions are useful in this situation. What are Lambdas in Python? Anonymous functions can be…

PDF Reporting Tool for Python Developers

Are you a Python Developer and looking for PDF reporting tools? In this article, we will list out some of the popular reporting tools that can help the python developers to generate PDF reports. PDF Reporting Tool for Python Developers Pod (Python Open Document) Sphinx – Python Document Generator Pisa – PDF generator using HTML and CSS Apache FOP (Formatting Objects Processor) Prince – Ideal…

Python Program to Convert Kilometers to Miles

This program demonstrates how you can convert kilometers to miles in Python. The conversion of Kilometer to miles is a kind of a simple calculation. The formula to calculate the mile from kilometers is below. 1 Mile = 1.60934 Kilometers. All that we need to do is do multiple the input (kilometers) by 0.621371 to get the total miles. How to Convert Kilometers to Miles…

continue statement in Python

This tutorial will teach you about the Python continue statement and how to use it to control the loop. Within a for loop or a while loop, the continue statement is used. The continue statement terminates the current iteration and begins the next. When a condition is True, you typically use the continue statement in conjunction with an if statement to skip the current iteration….

Python Program to Check If a Given Year is Leap Year

This Python program will demonstrate how you can check to see if a given year is a leap year or not. A leap year is a year that is exactly divisible by 4 except for the years that end with 00. For the years that ends with 00 , it is considered to be a leap year if it is divisible by 400. How to…

if statement in Python

You’ll learn how to utilise the Python if statement to run a block of code based on a condition in this article. The if statement is used to execute a block of code based on a condition. The if statement has the following syntax: The condition is checked first by the if statement. If the condition evaluates to True, the if-block statements are executed. Otherwise,…

Python Program to Add Two Numbers

This Python program demonstrates how you can add two numbers in python and display it using the print() function. Python Program to Add Two Numbers Python program to add two numbers Output The sum of 898.2 and 111.6 is 1009.8000000000001 In this program , the variables number1 and number2 contains the numeric values that needs to be added. These two variable values are added and…

Python Program to Check Prime Number

This Python program demonstrates how you can check if a given number is a prime number or not. A number is a prime number if the following confitions are satisfied It is a Positive Number It is Greater than 1. Has no other factors except 1 and the number itself. Some of the examples of a prime number are 2,3 etc. How to Check if…

Python Program to Print Prime Numbers in a Given Interval

This Python program explains how you can print prime numbers in a given interval in python using loops. A number is a prime number if the following conditions are satisfied It is a Positive Number It is Greater than 1. Has no other factors except 1 and the number itself. Some of the examples of a prime number are 2,3 etc. How to Print Prime…

Logical Operators in Python

This tutorial will teach you about Python logical operators and how to use them to combine multiple conditions. You might want to verify several conditions at once. Use logical operators to accomplish this. The logical operators in Python are as follows: andornot and operator in Python The and operator determines if two conditions are True at the same time: If both conditions are true, it…

List in Python

This tutorial will teach you about the Python List type and how to effectively manipulate list elements. What is a List? A list is an ordered grouping of items. Python indicates a list with square brackets ([]). The following is an example of an empty list: A list typically contains one or more items. A comma is used to separate two items (,). As an…

Python Program to Display Hello world

This is a simple program written in Python language that displays Hello World. The programs demonstrates how the Python code looks like and is a beginner program. Python Program to Display Hello world Output This program uses the python’s built-in print function to display the string Hello, world in the screen. The strings in python are by default in either single quotes , double quotes…