Make a program that asks for input from the user, apply eval to this input, and print out the type of the resulting object and its value. Test the program by providing five types of input: an integer, a real number, a complex number, a list, and a tuple.

Respuesta :

Answer:

x = input("Input a number ")

print(eval("x"))

print ("Type is:",type(x))

#Taking an float input

y = input("Input a number ")

print(eval("y"))

print ("Type is:",type(y))

#Taking an complex input

z = complex(input("Input a number "))

print(eval("z"))

print ("Type is:",type(z))

#Taking an List input

L_num = raw_input().split(",")

print(eval("L_num"))

print ("Type is:",type(L_num))

#Taking an tuple input.

T_num = raw_input().split(",")

print(eval("T_num"))

print ("Type is:",type(T_num))

Explanation: