0

I have question, why int(input()) why? Like i get question x = int(intput()) y = int(input()) why ?

8th May 2021, 11:09 PM
BG Plays
BG Plays - avatar
3 odpowiedzi
0
x = int(input()) so you can perform operations on 'x' as it is int instead of default string. For example if you want multiplication then: x = input() # let's make it '2' x*=3 # x = "222" But if we cast input to int: x = int(input()) # let's make it 2 x*=3 # x = 6
8th May 2021, 11:36 PM
Michal Doruch
+ 1
Input gets input from the user (as a string), int converts it to a number. Then you can use it for calculations
8th May 2021, 11:16 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
0
Yes,its right,but why int(input) I'm not discounted
8th May 2021, 11:30 PM
BG Plays
BG Plays - avatar