(Python Tutorials for Citizen Data Scientist) Python Program to Solve Quadratic Equation This program computes roots of a quadratic equation when coefficients a, b and c are known. The standard form of a quadratic equation is: ax2 + bx + c = 0, where a, b and c are real numbers and a ≠ 0 …
(Python Tutorials for Citizen Data Scientist) Python Program to Calculate the Area of a Triangle In this program, you’ll learn to calculate the area of a triangle and display it. If a, b and c are three sides of a triangle. Then, s = (a+b+c)/2 area = √(s(s-a)*(s-b)*(s-c)) Source Code # Python Program to find the area of triangle a …
(Python Tutorials for Citizen Data Scientist) Python Program to Find the Square Root In this program, you’ll learn to find the square root of a number using exponent operator and cmath module. Example: For positive numbers # Python Program to calculate the square root # Note: change this value for a different result num = …
(Python Tutorials for Citizen Data Scientist) Python Program to Add Two Numbers In this program, you will learn to add two numbers and display it using print() function. In the program below, we’ve used the + operator to add two numbers. Example 1: Add Two Numbers # This program adds two numbers num1 = 1.5 num2 = …
(Python Tutorials for Citizen Data Scientist) Python Code to Print Hello world! A simple program that displays “Hello, World!”. It’s often used to illustrate the syntax of the language. Source Code # This program prints Hello, world! print(‘Hello, world!’) Output Hello, world! In this program, we have used the built-in print() function to print the string Hello, world! on …