a = input ("Enter an integer: ")
b = 1
print(int(a) + b)
In this code, if you use an int type in parentheses, it is printed as an int type only in parentheses If it comes out again, it says it has a string value, so I'm asking why. I'm a beginner at coding for the first time, so please explain it easily..
python
In a print statement, no matter what you do to a variable, the value in the variable does not change.
Print statements are literally printing, not for storing separately.
Int(a) in the print function does not change the actual variable value.
It is just returning by changing the value of a to integer in the int()
a = int (input('integer input:')
If you do this, a will be assigned a value that changed the type to integer.
b = 1
print(b+1) # 2
print(b) # 1
b = b+1
print(b) # 2
It's the same logic as the code above.
555 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
557 Understanding How to Configure Google API Key
561 PHP ssh2_scp_send fails to send files as intended
564 Uncaught (inpromise) Error on Electron: An object could not be cloned
565 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.