No video

Python Program - Solve a Quadratic Equation

  Рет қаралды 77,694

Sharnav's Tech

Sharnav's Tech

Күн бұрын

Пікірлер: 95
@SharnavTech
@SharnavTech 4 жыл бұрын
Download Source Code:- bit.ly/3NMai3P • *Please Be Sure To Like this video, and Subscribe to my Channel* =================================================== *◘ My other Programming Tutorials →* My Python Tutorial Playlist : tiny.cc/amwaqz Print squares of numbers from 1 to x (Java): kzbin.info/www/bejne/gmbanaqgbbVjbK8 Multiplication Tables of Number (Java): kzbin.info/www/bejne/eJm5e6eHf6urhLM Auto Typer (Visual Basic Script): kzbin.info/www/bejne/nWLYemZneNCSeq8 Prank Virus (Visual Basic Script): kzbin.info/www/bejne/i6uaiKuIYs6nm6M =================================================== *• Some of my How-to Tutorials →* Add Custom Theme to IDLE: kzbin.info/www/bejne/gHiceJiaqsyEZ6M Change OEM information on Windows: kzbin.info/www/bejne/hpa4aIypga1pmac Add Icons to Folders: kzbin.info/www/bejne/jnazd6Voith8apY Change skin of your mouse cursor: kzbin.info/www/bejne/gHiceJiaqsyEZ6M Download KZbin videos using VLC: kzbin.info/www/bejne/gKCTnKydet-IsJI Change Lockscreen Background in Windows 7: kzbin.info/www/bejne/sKrYnpZoZdN7a5I
@anilkumarsharma8901
@anilkumarsharma8901 Жыл бұрын
give me html version for all this so its become interective and we make parabola according to given conditions
@pizza3454
@pizza3454 2 жыл бұрын
Dude, thank you. Just finished my homework!
@SharnavTech
@SharnavTech 2 жыл бұрын
Welcome :)
@pizza3454
@pizza3454 2 жыл бұрын
@@SharnavTech Hey, do you mind explaining what line 9 and 10 do? Didn't get that part.
@SharnavTech
@SharnavTech 2 жыл бұрын
Can you please just point out the timestamp in the video?
@pizza3454
@pizza3454 2 жыл бұрын
@@SharnavTech 4:39 and the one after.
@SharnavTech
@SharnavTech 2 жыл бұрын
@Pizza345 print(" ") is used to print an empty line. is an escape character, that is used to break a line. The next line just prints a statement. It uses an f-string, which is used to substitute value of a variable (inside { }) without concatenating the string. Its an alternative to string's format() method. Read more here - www.geeksforgeeks.org/formatted-string-literals-f-strings-python/amp/
@pralayrana2187
@pralayrana2187 2 жыл бұрын
Thank u bro! I was getting problem in complex no. but now it is solved. Thanks again!!
@SharnavTech
@SharnavTech 2 жыл бұрын
No problem!
@botgg7310
@botgg7310 Жыл бұрын
I just finished my class work thank you
@SharnavTech
@SharnavTech Жыл бұрын
Glad I could help!
@ascendedmemequeen925
@ascendedmemequeen925 2 жыл бұрын
you just saved my life, thank you
@SharnavTech
@SharnavTech 2 жыл бұрын
welcome! :)
@dawoodaltai6113
@dawoodaltai6113 3 жыл бұрын
I like your explanation 😇
@SharnavTech
@SharnavTech 3 жыл бұрын
Thanks
@yagomizuma2275
@yagomizuma2275 2 жыл бұрын
tip: put it in a while statement where r= int(input()) and while r>0 run the code above for homeworks then r=r-1
@yagomizuma2275
@yagomizuma2275 2 жыл бұрын
SORRY GUYS AN WHILE STATEMENT
@SharnavTech
@SharnavTech 2 жыл бұрын
So you mean to ask user how many times they want to run the code, and use while loop for that?
@yagomizuma2275
@yagomizuma2275 2 жыл бұрын
@@SharnavTech yeah
@oversipelio983
@oversipelio983 9 ай бұрын
great, thanks Sharnav
@SharnavTech
@SharnavTech 9 ай бұрын
You're most welcome!!
@oversipelio983
@oversipelio983 9 ай бұрын
@@SharnavTech bless you
@user-en1vt4cr2w
@user-en1vt4cr2w Жыл бұрын
Hello, Why I don't have the roots' results in the end? I followed all the steps and when I try to run the program the final line writes: Type of Roots: Two Distinct Real Roots Thank you in advance!
@SharnavTech
@SharnavTech Жыл бұрын
Check if you didn't forget to print the roots...If you didn't then contact me on Instagram (@techy_sharnav) or Discord (TechySharnav#1615) with the code
@obinnachika5096
@obinnachika5096 Жыл бұрын
Thanks alot 🤝🏿
@sanatathera5531
@sanatathera5531 Жыл бұрын
Thanks, very helpful!
@SharnavTech
@SharnavTech Жыл бұрын
Glad you found it useful...!
@manvithah8271
@manvithah8271 2 жыл бұрын
Thank you,nice demonstrate
@SharnavTech
@SharnavTech 2 жыл бұрын
Welcome!!
@gauravsavlani5725
@gauravsavlani5725 2 жыл бұрын
thank you
@SharnavTech
@SharnavTech 2 жыл бұрын
Welcome
@mominsiddiqui6927
@mominsiddiqui6927 2 жыл бұрын
Hello Sharnav, I dont seem to understand why my program is not running. I believe that I followed your instructions precisely. please let me know what I did wrong.
@mominsiddiqui6927
@mominsiddiqui6927 2 жыл бұрын
This is what I got import cmath >>> print("General Form: - a**2 + bx + c = 0") General Form: -a**2 + bx + c = 0 >>> a = int(input("Enter a (a != 0): ")) Enter a (a != 0): 1 >>> b = int(input("Enter b:")) Enter b:3 >>> c = int(input("Enter c: ")) Enter c: 4 >>> d = (b**2) - (4*a*c) >>> sol1 = (-b-cmath.sqrt(d))/(2*a) >>> sol2 = (-b+cmath.sqrt(d))/(2*a) >>> print(" ") >>> print(f"Results for equation, {a}x**2 + {b}x + {c} =0, are :- ") if d>0: print("Type of Roots : Two Distinct Real Roots") elif d == 0: print("Type of Roots : Two Equal Real Roots") elif d < 0: print("Type of Roots : Two Complex Roots") print(f"The solutions are {sol1} and {sol2}")
@SharnavTech
@SharnavTech 2 жыл бұрын
Connect with me on Discord (TechySharnav#1615) or Instagram (@techy_sharnav)
@selvaajith4384
@selvaajith4384 3 жыл бұрын
Sir, how can i decrese the power of x value? For example, input is 5*x***3 expecting output is 5*x**2
@SharnavTech
@SharnavTech 3 жыл бұрын
First, ** is a standard notation for exponents. Therefore, it would be 5*x**3 (equivalent to 5x³). Now If I got you correctly, the entire 5x³ term is an input, right?
@selvaajith4384
@selvaajith4384 3 жыл бұрын
@@SharnavTech Right sir...... How can i decrese the power of x in my output..... Plz help me
@SharnavTech
@SharnavTech 3 жыл бұрын
@@selvaajith4384 Divide the term by 5. You get x**3 term. Now take cube root of it, by raising it to power 1/3. Now Take Square of it, and multiply by 5. You get your desired output. Here's a small snippet to help you out:- gist.github.com/TechySharnav/29c9dd3235145de0496812953b4b4a06
@selvaajith4384
@selvaajith4384 3 жыл бұрын
@@SharnavTech thank you sooooooooooo much sir
@selvaajith4384
@selvaajith4384 3 жыл бұрын
@@SharnavTech hai sir...... Sorry to disturbing you..... One more doubt sir....... Same question if user give input as 5*x***3+5*x**2+5*x+5=0 Output be like 5*x**2+5*x+5=0(decrease the x value ) but we solve it with list, array, and for loop........help me sir
@rishavbhattarai807
@rishavbhattarai807 3 жыл бұрын
Ohh my god Thanks man
@SharnavTech
@SharnavTech 3 жыл бұрын
Welcome
@iqraiqraquyyum3165
@iqraiqraquyyum3165 3 жыл бұрын
You are using print(f"results for equation.....) In this line error exist please help how to remove this error and the error is based on ("") in worded comma's
@SharnavTech
@SharnavTech 3 жыл бұрын
Use triple quotes to put both single quotes and double quotes in a string. Example: print(f'''results ....''')
@utkarshrai101cartoonwala
@utkarshrai101cartoonwala 3 жыл бұрын
@@SharnavTech why we use f here
@SharnavTech
@SharnavTech 3 жыл бұрын
'f' here denotes that we will be formatting the string. These strings are also called F-Strings. The basic usage of f strings is to make string interpolation easier.
@emperorx5909
@emperorx5909 4 жыл бұрын
Hello, an IITian here, please don't teach students how to cheat during online test as students below 11th grade have their test online ...😇😇
@SharnavTech
@SharnavTech 4 жыл бұрын
Thanks for exposing the idea to everyone 🙂
@thunderboiii415
@thunderboiii415 2 жыл бұрын
Sorry it's not mandatory to tell the name of your school/college/university here, that's very lame . And, if it comes to cheating in online exams using this that's not his problem it's the problem of the schools they must keep enough maintenance so that a child can't cheat. Here is just a tutorial given for people to solve algebraic problems using python and that's a very good job don't spread hatred spread love 😇😇
@SharnavTech
@SharnavTech 2 жыл бұрын
He was joking ig..
@emperorx5909
@emperorx5909 2 жыл бұрын
@@thunderboiii415 Grow up kid, that was a joke, stop being toxic
@bangstar719
@bangstar719 3 ай бұрын
is there a way to print only real values? so just to make 0*j=0
@SharnavTech
@SharnavTech 3 ай бұрын
You can use the .real property to get the real part of complex number. For example, if X is the complex number, you can do print(X.real)
@bangstar719
@bangstar719 3 ай бұрын
@@SharnavTech yeah but how can i merge that with text? like if we had print(f"The solutions are {sol1} and {sol2}"), where should we put .real? because I guess I tried all combinations but none worked.
@SharnavTech
@SharnavTech 3 ай бұрын
sol1 and sol2 are variables, so you can do print(f"...{sol1.real} and {sol2.real}")
@yagomizuma2275
@yagomizuma2275 2 жыл бұрын
hello man, i have 2 questions 1-does cmath matter? Because i used normal x1= ...d**0.5... and it works! 2- is there a way to make this code faster? i use qpython3l to code most of the time so it would useful for me. appreciated
@SharnavTech
@SharnavTech 2 жыл бұрын
1. No, cmath doesn't really matter. You can also do **0.5 2. Not really. The only time you can save is while entering the input. Instead of asking user to enter coefficient one by one, you can ask him to enter comma separated values. a,b,c = [int(i) for i in input("Enter a, b, c: ").split(",")]
@azranaz5989
@azranaz5989 2 жыл бұрын
please try to upload without background music, it's vert distracting. Thank you
@SharnavTech
@SharnavTech 2 жыл бұрын
Yes, I have changed and lowered the background music's volume in my latest videos.
@azranaz5989
@azranaz5989 2 жыл бұрын
@@SharnavTech thank you so much
@SharnavTech
@SharnavTech 2 жыл бұрын
No problem!
@LigmaBallz2137
@LigmaBallz2137 Жыл бұрын
It's 2:30 am and I got a test from IT class Hopefully I understand something 💀
@SharnavTech
@SharnavTech Жыл бұрын
All the best for your test!
@sanjadebbarma2388
@sanjadebbarma2388 Жыл бұрын
what is the use of this formula in softwere world i m new in computer world this is why this question came in my mind
@SharnavTech
@SharnavTech Жыл бұрын
Well... technically it doesn't have much practical use cases. It is mostly used for personal projects.
@krishpal5009
@krishpal5009 Жыл бұрын
Actually we create a variable to define its vale in some memory..sir corret me if im wrong
@Shs-fx1fi
@Shs-fx1fi 2 жыл бұрын
Why that 0j is getting printed in the result ?
@SharnavTech
@SharnavTech 2 жыл бұрын
'j' denotes an imaginary part of complex number. If the solution is real, it will print 0j, which means it has no imaginary part
@Shs-fx1fi
@Shs-fx1fi 2 жыл бұрын
@@SharnavTech ohh ok thanks
@megliotwitch6693
@megliotwitch6693 11 ай бұрын
how do i make it so that the numbers are fractions and not decimals?
@SharnavTech
@SharnavTech 11 ай бұрын
Check at stackoverflow.com/q/23344185/9256189
@megliotwitch6693
@megliotwitch6693 11 ай бұрын
@@SharnavTech thank you
@dre9840
@dre9840 3 жыл бұрын
nice
@SharnavTech
@SharnavTech 3 жыл бұрын
Thanks!
@cdemr
@cdemr 2 жыл бұрын
File "D:\Visual Studio\Projects\quadratic formula\quadratic formula\quadratic_formula.py", line 12 sol2 = (-b+cmath.sqrt(d)/(2*a) ^ SyntaxError: invalid syntax Press any key to continue . . . is the only result I get from this program 😶 where did i f up...
@SharnavTech
@SharnavTech 2 жыл бұрын
You are missing a closing ')' bracket in the numerator. It should be sol2 = (-b+cmath.sqrt(d))/(2*a)
@cdemr
@cdemr 2 жыл бұрын
@@SharnavTech thanks, I solved it yesterday
@jesuisravi
@jesuisravi 2 жыл бұрын
I appreciate that you magnify the code so it is easy to read. But I hate the music.
@SharnavTech
@SharnavTech 2 жыл бұрын
Thanks and Sorry for that. I have changed the music now.
@lau-renpandoura3192
@lau-renpandoura3192 Жыл бұрын
I'm sure your tutorial is nice and all, but the combination of that music + the Google Translate voice made me wanna end it all
@SharnavTech
@SharnavTech Жыл бұрын
Sorry, I had the video made in a rush...Can you give feedback on my latest videos? They have improved a lot.... And it is not Google Translate Voice :)
@elgunasgarov535
@elgunasgarov535 Жыл бұрын
hello, cod2
@SharnavTech
@SharnavTech Жыл бұрын
Hi (it's cod bo 2 to be precise)
@gill19931
@gill19931 3 жыл бұрын
Hello, can you solve this question Consider the equation Ax2 + B = 0.  If B/A < 0, this equation has two solutions. The solutions are: (1) X1 = Sqrt(-B/A) (2) X2 = −Sqrt(-B/A)  If B/A = 0, this equation has one solution which is X = 0  If B/A > 0, this equation has no real number solutions Draw a flowchart and Write a program to have the user input any numbers for the coefficients, A and B, for this equation. If A = 0, terminate the program. Otherwise, solve the equation.
@SharnavTech
@SharnavTech 3 жыл бұрын
Yeah, it's pretty easy. It would require multiple if elif conditions. Based on the condition, you can calc and print the output. Make sure to include a == 0 as 1st condition, since the program has to be terminated. I recommend you to try on your own first. If you get stuck or need help, I am here. :)
Python Program - Transpose a Matrix | Nested For Loops | Easy Method
6:08
1st Year Calculus, But in PYTHON
32:13
Mr. P Solver
Рет қаралды 124 М.
Survive 100 Days In Nuclear Bunker, Win $500,000
32:21
MrBeast
Рет қаралды 164 МЛН
Meet the one boy from the Ronaldo edit in India
00:30
Younes Zarou
Рет қаралды 18 МЛН
Get 10 Mega Boxes OR 60 Starr Drops!!
01:39
Brawl Stars
Рет қаралды 18 МЛН
Python Program to Find Roots of the Quadratic Equation
10:30
Code of the Future
Рет қаралды 14 М.
Why you didn't learn tetration in school[Tetration]
6:23
Prime Newtons
Рет қаралды 3,9 МЛН
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 298 М.
25 nooby Python habits you need to ditch
9:12
mCoding
Рет қаралды 1,7 МЛН
Researchers thought this was a bug (Borwein integrals)
17:26
3Blue1Brown
Рет қаралды 3,5 МЛН
What's Your ENGLISH LEVEL? Take This Test!
21:31
Brian Wiles
Рет қаралды 2,1 МЛН
so you want a VERY HARD math question?!
13:51
blackpenredpen
Рет қаралды 1 МЛН
Introduction to For Loops in Python (Python Tutorial #5)
10:22
CS Dojo
Рет қаралды 1,6 МЛН
Survive 100 Days In Nuclear Bunker, Win $500,000
32:21
MrBeast
Рет қаралды 164 МЛН