Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 14 Online
OpenStudy (anonymous):

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

OpenStudy (anonymous):

each statement goes on a line by itself.

OpenStudy (anonymous):

How do you create a new line without pressing enter?

OpenStudy (anonymous):

You cannot. Why don't you want to hit enter?

OpenStudy (anonymous):

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.

OpenStudy (anonymous):

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

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!