Knowee
Questions
Features
Study Tools

Select the correct answerWhat will be the datatype of the var in the below code snippet?var = 10print(type(var))var = "Hello"print(type(var))Optionsint and strint and intstr and intstr and str

Question

Select the correct answerWhat will be the datatype of the var in the below code snippet?var = 10print(type(var))var = "Hello"print(type(var))Optionsint and strint and intstr and intstr and str

🧐 Not the exact question you are looking for?Go ask a question

Solution

The correct answer is int and str.

Here's why:

In the first line, var is assigned the value 10, which is an integer (int). So, when you print the type of var, it will return <class 'int'>.

In the fourth line, var is assigned the value "Hello", which is a string (str). So, when you print the type of var again, it will return <class 'str'>.

Therefore, the datatype of var changes from int to str in this code snippet.

This problem has been solved

Similar Questions

ect the correct answerWhat will be the datatype of the var in the below code snippet?var = 10print(type(var))var = "Hello"print(type(var))

Select the correct answerWhich of the following function is used to know the data type of a variable in Python?Optionstypeof()datatype()type()vartype()

What will be the output of the following code?Name = ‘saif’print(type(Name))Options: Pick one correct answer from belowintstrcomplexNone of the above

The following code example would print the data type of x, what data type would that be?x = "Hello World"print(type(x))

The following code example would print the data type of x, what data type would that be?x = 5print(type(x))

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.