Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

minimallinux Group Title

Just a thought on the print statement, where we have String = hello world, it can be printed with or without brackets, like print String OR print(String) Is there a recommended or preferred way of doing this ?

  • one year ago
  • one year ago

  • This Question is Closed
  1. Chris2332 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    You will need quotes for one. Then I think that it depends on the version of Python if the brackets are required or not!

    • one year ago
  2. MicroBot Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    ye i agree with Chris

    • one year ago
  3. minimallinux Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    No,only quotes used on assigning the value, on printing out see below both ways >>> String = 'hello world' >>> print String hello world >>> print(String) hello world

    • one year ago
  4. MicroBot Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    what chris says is that some older versions might not work without brackets or find brackets wrong. what python version do u use? tbh if i could use both id choose the brackets cause seems more clean that way.

    • one year ago
  5. minimallinux Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    That's what I thought, seems better with the brackets

    • one year ago
  6. kTwitch Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    Python 3 requires print (), while Python 2.x is fine with either. I generally see it not using parentheses if it's Python 2.x.

    • one year ago
  7. msmithhnova Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    kTwitch is right and since I use 3.x for a different course I prefer to use the brackets rather than switching back and forth.

    • one year ago
    • Attachments:

See more questions >>>

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.