filmov
tv
Solving quadratic equations using Python | Easy Solution
Показать описание
Hey Guys! In this video, you will learn how to solve quadratic equations using python. In this program, we are utilizing regular expressions and functions. Please like and subscribe!
Sample code (paste this into your text editor and save it as a .py file):
import re
def sqrt(intg):
return intg ** 0.5
def quadratic_formula1 (a, b, c):
delta = b**2 - 4*a*c
numerator = -b + sqrt(delta)
denominator = 2*a
root1 = numerator/denominator
return root1
def quadratic_formula2 (j, k, l):
delta2 = k**2 - 4*j*l
numerator2 = -k - sqrt(delta2)
denominator2 = 2*j
root2 = numerator2/denominator2
return root2
equation = input('Please enter the equation in the following format: \nax^2 + bx + c = 0: \n')
quadratic_coefficient = int(numbers[0])
linear_coefficient = int(numbers[2])
constant = int(numbers[3])
result1 = quadratic_formula1(quadratic_coefficient, linear_coefficient, constant)
result2 = quadratic_formula2(quadratic_coefficient, linear_coefficient, constant)
print('\nThe results are: ', '\nx1 = ', result1, ' ', 'x2 = ', result2)
Sample code (paste this into your text editor and save it as a .py file):
import re
def sqrt(intg):
return intg ** 0.5
def quadratic_formula1 (a, b, c):
delta = b**2 - 4*a*c
numerator = -b + sqrt(delta)
denominator = 2*a
root1 = numerator/denominator
return root1
def quadratic_formula2 (j, k, l):
delta2 = k**2 - 4*j*l
numerator2 = -k - sqrt(delta2)
denominator2 = 2*j
root2 = numerator2/denominator2
return root2
equation = input('Please enter the equation in the following format: \nax^2 + bx + c = 0: \n')
quadratic_coefficient = int(numbers[0])
linear_coefficient = int(numbers[2])
constant = int(numbers[3])
result1 = quadratic_formula1(quadratic_coefficient, linear_coefficient, constant)
result2 = quadratic_formula2(quadratic_coefficient, linear_coefficient, constant)
print('\nThe results are: ', '\nx1 = ', result1, ' ', 'x2 = ', result2)
Python Program - Solve a Quadratic Equation
Python Program to Find Roots of the Quadratic Equation
Roots Of Quadratic Equation In Python | Python Practice 5 | Newtum Solutions
Python Program to Solve Quadratic Equation (English) | Tutorial for Beginners
Python Program To solve Quadratic Equation #shorts #coding #python #programming
Python 3 Tutorial - Quadratic Equation Solver
Solving Quadratic Equation using Python
Python # 7 : Solve quadratic equation using Programming
Python Program to Calculate and Print the Roots of quadratic Equation
Solve Quadratic Equations [With Python] #programming #algebra #maths #howto
A Beginner's Guide to Solving Quadratic Equation with python
Solving Quadratic Equations in Python: A Step-by-Step Tutorial
Python programming - How to solve quadratic equations using python
Solving Quadratic Equation using Python
Python program to find roots of quadratic equation #shorts #coding #programming
Solving quadratic equations using Python | Easy Solution
How to solve Quadratic Equation using python language
Python Program Solve Quadratic Equation #shorts
Simple Easy Quadratic Equation in Python Programming Language
Solving a quadratic equation in python
Python project-solve quadratic equations
Solving QUADRATIC EQUATIONS using Python
#9 Solve Quadratic Equation using Python | Python for Beginners | Zero to Hero
Solving Quadratic Equation using python
Комментарии