Python Star Pattern Example : 1 ** ** * ** * * ** * * * * Python for i in range(0, 5): for j in range(0, i+1): print("* ",end="") print() 123456 for i in range(0, 5): for j in range(0...
Tag - Python Simple Examples
Python Data Types with Examples
In this post, we will learn about the data type used in Python. Every programming language has this same concept as the data type. Similarly, Python has a data type of every variable that is used in the code. The datatype is very...
Find Sum Of Elements In A List in Python
In this article, we will learn How to find sum of elements in a list in Python. In this article, we will show you how to find the sum of numbers of the list in Python language;. This programs take input from the user for the list...
Find the Greatest of Three Numbers Using the Function in Python
In this example, we will discuss the concept of the Python program:find the greatest of three numbers using the function In this post, we will learn how to find the greatest number of three numbers using a user-defined function...
Add Two Number Using Function in Python
In this tutorial, we will learn a simple concept of how to add two numbers using the function in the Python programming language. Add two integer number using the function Python #Python program to add two numbers using function...
Sort a Dictionary in Python
In this example, we will learn how to sort a dictionary in python. In the below example we will sort a dictionary by key, value, and items. Sort by key: Python dict = {} dict['1'] = 'Ford' dict['4'] = 'Audi' dict['2'] = 'Toyota'...
Simple Python Programs with Examples
The best way to learn Python is by practicing examples. The page contains examples on basic concepts of Python. You are advised to take the references from these examples and try them on your own. All the programs on this page...
Filter the Positive Numbers from a list in Python
In this example, i’ll show you how to filter the positive numbers from a list. Python Code: Python nums = [-15, 12, 15, -5] print("Original numbers in the list: ",nums) Pos_nums = list(filter(lambda x: x >0, nums))...
Python Program to Check Whether a Number is Even or Odd
In this example, you will learn to check whether a number entered by the user is even or odd. In the program, the integer entered by the user is stored in the variable num. Then, whether num is perfectly divisible...
Calculate the Sum of Three Given Numbers
Write a Python program to calculate the sum of three given numbers, if the values are equal then return thrice of their sum. Python Code: Python def sum_thrice(x, y, z): sum = x + y + z if x == y == z: sum = sum * 3 return sum...