String input being read as integer in REPL build (Python3)
Doing this simple program:
Name = input("Please enter your name: ")
Age = input("Please enter your age: ")
When I run it with REPL in Sublime it takes the name no problem, but when I input the age REPL highlights it as an integer and doesn't receive the input. (When I run it through the terminal it works as intended).
Sorry if the format of this question is off, still trying to figure stuff out.
@DynamicSquid yeah I'm trying to follow along on some pirple videos (and reading Python Crash Course), so it can be confusing when the code and result don't exactly match up. I knew I was doing it right since it worked in the Terminal and here, just wasn't sure if I needed to do any more changes to the REPL package in Sublime to make it work in there.
Figured out the issue: The plug-in keyboard I'm using has a keypad on the side and SublimeREPL doesn't recognize it as input. If I use the numbers above the letter keys it works fine. Weird!
Age = input("Enter your age: ")
you have to do
Age = int(input("Enter your age: ") print(Age)
By default python reads all inputs as strings so if there is a value that you want to get that is an integer, just use int(input(. you can also convert a string variable to an integer in text by using
intvar = int(strvar)
or vice versa
strvar = str(intvar)
@LukeWright Thanks for the response. I don't want it as an integer, I DO want it as a string, but in Sublime it reads the input as an integer. My code works as intended when I run it here and on the Terminal, but when I run SublimeREPL it keeps on reading the number input as an integer rather than a string.