How do you type multiple commands? Ex: string1 = str(input("Type in a string: "))print ("The string is", len string1), "characters long.") SyntaxError: invalid syntax
each statement goes on a line by itself.
How do you create a new line without pressing enter?
You cannot. Why don't you want to hit enter?
Your example wouldn't be possible as one statement. You must capture string1 as input before counting its length - two statements therefore two lines. There is a new line "\n" character but that is for output, not for coding.
I think what is happening is that you are typing in the interpreter(shell) because in the interpreter when u hit enter it runs your command. To make a program you have to make a textfile. To do this go up to file, new window or press "ctrl+n". This is where you type your programs then go to the run tab at the top or press F5 to run it
Join our real-time social learning platform and learn together with your friends!