Print the ASCII value of Characters
charr =(input("Enter a charcater"))
print("The ASCII value of '" + charr + "' is", ord(charr))


Find the roots of quadratic equation
import cmath
a = int(input("Enter the value of a "))
b = int(input("Enter the value of b "))
c = int(input("Enter the value of c "))
# calculating the discriminant
d = (b**2) - (4*a*c)
# finding solutions
sol1 = (-b-cmath.sqrt(d))/(2*a)
sol2 = (-b+cmath.sqrt(d))/(2*a)
print('The solution are {0} and {1}'.format(sol1,sol2))

Leave a comment