#python

Publicado el: 23 diciembre 2024
en el canal de: Mastering Technology
61
10

Python accepts a value and determines the type entered by the user with the help of eval() along with input() function.

If we are using only input() function, the type of variable entered by the user is always String.

age=input("Enter the age ")
print('age', age)
print(type(age))

Output:
Enter the age 45
age 45
class 'str'

If we are using eval() along with input() function, it automatically detects the type of variable entered by the user.

num=eval(input(("Enter the number ")))
print('num', num)
print(type(num))

Output:
Enter the number 67
num 67
class 'int'

#pythonprogramming #function #effortless #coding #developer #datatypesinpython #automation #pycharm


En esta página del sitio puede ver el video en línea #python de Duración hora minuto segunda en buena calidad , que subió el usuario Mastering Technology 23 diciembre 2024, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 61 veces y le gustó 10 a los espectadores. Disfruta viendo!