Day: January 9, 2021

Python Examples for Beginners: Python Code to Make a Simple Calculator

(Python Tutorials for Citizen Data Scientist) Python Code to Make a Simple Calculator In this example you will learn to create a simple calculator that can add, subtract, multiply or divide depending upon the input from the user. Example: Simple Calculator by Using Functions # Program make a simple calculator # This function adds two …

Python Examples for Beginners: Python Code to Find the Factors of a Number

(Python Tutorials for Citizen Data Scientist) Python Code to Find the Factors of a Number In this program, you’ll learn to find the factors of a number using the for loop. Source Code # Python Program to find the factors of a number # This function computes the factor of the argument passed def print_factors(x): …

Python Examples for Beginners: Python Code to Find LCM

(Python Tutorials for Citizen Data Scientist) Python Code to Find LCM In this program, you’ll learn to find the LCM of two numbers and display it. The least common multiple (L.C.M.) of two numbers is the smallest positive integer that is perfectly divisible by the two given numbers. For example, the L.C.M. of 12 and …

Python Examples for Beginners: Python Code to Find HCF or GCD

(Python Tutorials for Citizen Data Scientist) Python Program to Find HCF or GCD In this example, you will learn to find the GCD of two numbers using two different methods: function and loops and, Euclidean algorithm The highest common factor (H.C.F) or greatest common divisor (G.C.D) of two numbers is the largest positive integer that …

Python Examples for Beginners: Python Code to Find ASCII Value of Character

(Python Tutorials for Citizen Data Scientist) Python Program to Find ASCII Value of Character In this program, you’ll learn to find the ASCII value of a character and display it. ASCII stands for American Standard Code for Information Interchange. It is a numeric value given to different characters and symbols, for computers to store and …

Python Examples for Beginners: Python Code to Add Two Numbers

(Python Tutorials for Citizen Data Scientist) Python Code to Convert Decimal to Binary, Octal and Hexadecimal In this program, you’ll learn to convert decimal to binary, octal and hexadecimal, and display it. The decimal system is the most widely used number system. However, computers only understand binary. Binary, octal and hexadecimal number systems are closely …

Python Examples for Beginners: Python Code to Find Numbers Divisible by Another Number

(Python Tutorials for Citizen Data Scientist) Python Program to Find Numbers Divisible by Another Number In this program, you’ll learn to find the numbers divisible by another number and display it.   In the program below, we have used anonymous (lambda) function inside the filter() built-in function to find all the numbers divisible by 13 in the …

Python Examples for Beginners: Python Code To Display Powers of 2 Using Anonymous Function

(Python Tutorials for Citizen Data Scientist) Python Code To Display Powers of 2 Using Anonymous Function In this program, you’ll learn to display powers of the integer 2 using Python anonymous function. In the program below, we have used an anonymous (lambda) function inside the map() built-in function to find the powers of 2. Source Code # …