input() function Flashcards

1
Q

What is input() function used for?

A

The input() function is used to accept the value for a variable from the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to input integer and float values?

A

To input integer and float values, use int() or float() along with input().

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What data type does the input() function take by default?

A

In Python, input() function takes one string argument, which means that whatever value is being entered by the user will be taken as a string argument.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What happens when you do not write int()?

A

When you do not write int() along with input(), it takes the values as string and joins them instead of adding them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What would happen if you tried to multiply without adding int()?

A

When you try to multiply without writing int(), it gives an error as you cannot multiply string values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What happens when you use the int() function?

A

When you use the int() function along with the input() function, it considers the values as integers and they can now be added or multiplied like normal.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly