9 AnswersNew Answer
You can absolutely do so, but if you want to do some sort of mathematical operations with age variable in between of input and output, you won't be able to do so, as if you don't use int() function, your variable age will be of type string.
Oh i understand thank you very much
There is no problem with keeping the input as a string if you only use it as a string. In fact, that way is more efficient. However, if you need to perform calculations with the numeric value, then that is when you must convert it to a numeric type.
Sean Simmons , not only for mathematical operations we need e.g. integer values, also using relational operators with "string numbers" can lead to suspicious results: print('17' < '21') # result is True because 17 is less than 21 print('117' < '21') # result is True but 117 is not less than 21 in both cases the comparison is done by a lexicographical comparison by using the ascii or unicode values.
If you write just input(), your input will be a string. That is why you have to write int(input()). If you write int(input()) then your input will be an integer.Or you can use input=int(input). THANKS.
When you just give input() python consider it as string think python like you are talking to python(person) by giving commands like that it will be more simple to understand so Age is here in numbers form (integer) so you have to tell python that it should be converted to integer form (Numbers) so by doing it int(input()) Python will convert string to integer
Is there any difference though because i was just redoing everything making notes and saw that on severel briefs it says the same thing but to do it a different way
You can do that
The int function changes any primitive data type to the integer data type