print("Solving the quadratic equation ax^2 + bx + c")
a, b, c = eval(input("Enter a, b, c "))


a = eval(input("Enter a "))


Python's eval function interprets the character string and determines its type automatically. So if you enter the number 25, the eval function converts it to an integer, assigns it to the variable a and gives a the type int.

name = eval(input("Enter your name "))


If you on the other hand needed to enter a string.
then Python expects that what you type follows its rules for a Python string constant. So when you input your name, you must enclose what you type with single or double quotes. Then Python treats it as a string and name becomes a string variable.
Test how eval works in a file called eval.py :
  • define a value of b in your code to equal 10. Now Enter the value of a with eval to be equal to 5. Test the output of a + b
  • Define a variable called Yourname to be equal to "Your name is " Now Enter the value of name to be your name. Try to add the two string Yourname and name. Print it out.
  • Define a variable called Yourage to be equal to "Your age is " Now Enter the value of age to be your age (i.e. 21). Try to add the the string and the integer. Print it out.
  • Now back to the code in the file.
    print("Solving the quadratic equation ax^2 + bx + c")
    a, b, c = eval(input("Enter a, b, c "))
    
    
    Note that here you are able to enter multiple variables of (integer) at once. Not just a but also a,b,c. When you enter these variable you need to have a comma in between for example. 1,5,6 .