'what is the difference between int(input()) and just input() [duplicate]
I am new to python, and when I use the input() for any inputs including numbers it works, but my teacher is saying to use int(input()) for integer-based inputs. Can someone explain what is the difference between these syntaxes?
Solution 1:[1]
input() returns a string.
To change it to a number(an integer) do int(), so it would be int(input()).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | kenntnisse |
