Computer Science, asked by vikasnishad41279, 1 month ago

Que 1.47. What will be the data type of x after the following statement if input entered is 18? x= input('Enter a number:')​

Answers

Answered by AbdulHafeezAhmed
0

The datatype will be of string

Answered by qwnerazzuri
0

The data type of 'x' will be a string.

we have, x= input('Enter a number:')​

Above is an input statement written in python language. The output of this snippet will be an input box followed by a title "Enter a number:".

When the user gives input in the input box then the entered value is converted to a string value as the "input()" function takes only a string value, even if we enter a numeric value, this will change the data type to string and the numeric value will be considered as a string value to the compiler.

To take a numeric value as input we need to convert the type:

x = int(input("Enter a number:))

Similar questions