Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

quadratic formula python

from cmath import sqrt as c_sqrt
from math import sqrt as m_sqrt
import tkinter as tk

# creates and runs an instance of the window
window = tk.Tk()

#makes the size of the widow
window.geometry("600x400")

#sets a title for the screen
window.title("intercode")

# creating a new label and adding a text to the window
new_label=tk.Label(window,text='enter a,b,c quadratic formula
')
new_label.pack()

#creates a entrybox to add words to window
entry_label1=tk.Entry(window)
entry_label1.pack()

entry_label2=tk.Entry(window)
entry_label2.pack()

entry_label3=tk.Entry(window)
entry_label3.pack()
# defines results as string var
results= tk.StringVar(window)



#creating a results label
result_lable=tk.Label(window,textvariable=results)
result_lable.pack()



def callbackfunct():
    a =entry_label1.get()
    b =entry_label2.get()
    c =entry_label3.get()
    try:
        a= float(a)
        b= float(b)
        c= float(c)

    except ValueError:
        results.set("
Enter number.")


    if (b**2-4*a*c) < 0:
        minus = (-b-c_sqrt(b**2-4*a*c))/(2*a)
        plus = (-b+c_sqrt(b**2-4*a*c))/(2*a)
    else:
        minus = (-b-m_sqrt(b**2-4*a*c))/(2*a)
        plus = (-b+m_sqrt(b**2-4*a*c))/(2*a)
        
    # deletes the text in the text box
    entry_label1.delete(0,tk.END)
    entry_label2.delete(0,tk.END)
    entry_label3.delete(0,tk.END)

    var = (f"'B+'   {plus} , 'B-'   {minus}")
    results.set(var)
# creating a button with a command
buttonez = tk.Button(text="Submit", command=callbackfunct)
buttonez.pack()

window.mainloop()
Comment

Python Program to Solve Quadratic Equation

roots = ( -b + sqrt(b ^ 2 - 4 * a *c) ) / (2 * a)   , ( -b - sqrt(b ^ 2 - 4 * a *c) ) / (2 * a)
Comment

python code for quadratic equation

from math import sqrt

def quadratic(a, b, c):
    x1 = -b / (2*a)
    x2 = sqrt(b**2 - 4*a*c) / (2*a)
    return (x1 + x2), (x1 - x2)
Comment

quadratic equation python

print ("ax2 + bx + c = 0")
a = float(input("a: "))
b = float(input("b: "))
c = float(input("c: "))
delta = (b**2) - (4*a*c)
answers = []
numerator = [-b + delta**0.5, -b - delta**0.5]

denominator= 2 * a

for i in range(2):
    ans = numerator[i] / denominator
    answers.append(ans)
print (answers)
Comment

python basic programs quadratic equation

(-b ± (b ** 2 - 4 * a * c) ** 0.5) / (2 * a)
Comment

python basic programs quadratic equation

ax2 + bx + c = 0, where
a, b and c are real numbers and
a ≠ 0
Comment

quadratic equations in python

def square(n):
  num=n
  newnum=n*n
  return newnum
  
Comment

PREVIOUS NEXT
Code Example
Python :: how to decode hexadecimal in python 
Python :: python write yaml 
Python :: sqlite3 like python 
Python :: python detect keypress 
Python :: python gt index in for cycle 
Python :: import settings 
Python :: qspinbox disable wheel python 
Python :: import tknter 
Python :: olst = [] a = int(input()) b = int(input()) for ele in range(a,b+1): if ele%2 != 0: olst.append(ele) print(olst[::-1]) 
Python :: how to print the text of varying length in python 
Python :: How to get key value list from selection fields in Odoo 10 
Python :: requirements.py for flask 
Python :: how to take a screenshot using python 
Python :: find todays date in python 
Python :: drop first column pandas 
Python :: python get words between two words 
Python :: datafram from one date to another 
Python :: dropdown menu for qheaderview python 
Python :: python spamming bot 
Python :: drop a column in pandas 
Python :: python sort list in reverse order 
Python :: pandas split train test 
Python :: sdsdsdsdsddsdddsdsdsdsdsdsdsdsdsdsdsdsdsdssdsdsdsdsdsdsdssssssddsdssdssssdsdsdsdsdsdsdsdsdsdsdsdsdsdssdssdsdsdsdsdsdsdsdsdsdsdssd 
Python :: raatatatatatatatatatatatatatatatatatatatatatatatatatatattatana 
Python :: matplotlib display axis in scientific notation 
Python :: jupyter notebook attach image 
Python :: albert pretrained example 
Python :: How to create an efficient median finder for a stream of values, in Python? 
Python :: datetime current year 
Python :: python replace newline 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =