User Input and Type Casting in Python

User Input and Type Casting in Python:

We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it.

(1) In Python, we have the input() function for taking the user input. The input() function prompts the user to enter data. It accepts all user input as a string. The user may enter a number or a string but the input() function treats them as strings only.

input function in python
python user input function

(2) Type Casting is a technique for converting a variable’s data type to a specific data type to conduct the action requested by users.

type casting in python
eval function python 1

Using the eval function you can also add int and float values with binary values and get the desired result.


Python Logical Operators or Boolean Operators
Python Membership Operators
Python Identity Operators
Python Bitwise Operators
Python Data Types
String Concatenation in Python
Python (programming language)– Wikipedia

Comments (No)

Leave a Reply