A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

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

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    each statement goes on a line by itself.

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    How do you create a new line without pressing enter?

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  4. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  5. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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

  6. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.