Python Forum
My first complex(ish) code .
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My first complex(ish) code .
#1
My first code which is complex(ish).It is for quadratic equations. it may be a bit janky or bigger idk.It is made without any totorials so
thats why I want feed back .Started learning in the begining of covid ( not much experince ) . I dont know how to attach files so hope pasting the code is ok ?. And I am using replit.com not a code thing (idk what it is called) on my computer.
def lineard (x,y,z) :
  return y*y-4*x*z 

a =int(input("Value of a = "))
b =int(input("Value of b = "))
c =int(input("Value of c = "))
p =lineard (a,b,c)
print(p)

import math

if p > 0 :
 print("real and different roots")
 print((-b+math.sqrt(p))/2 * a) 
 print((-b-math.sqrt(p))/2 * a) 
elif p == 0 : 
  print("real and same roots")
  print(-b/2*a)
else:
 print("roots are not real ")
  
if a == 0:
  print("give valid numbers")
Smile
Yoriz write Jun-19-2021, 08:49 AM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
My first complex(ish) code . - by DUDDLEGOD - Jun-19-2021, 08:30 AM
RE: My first complex(ish) code . - by Larz60+ - Jun-19-2021, 11:17 AM
RE: My first complex(ish) code . - by DUDDLEGOD - Jun-21-2021, 07:27 AM
RE: My first complex(ish) code . - by Yoriz - Jun-19-2021, 11:51 AM
RE: My first complex(ish) code . - by perfringo - Jun-19-2021, 12:16 PM
RE: My first complex(ish) code . - by DUDDLEGOD - Jun-21-2021, 07:31 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020