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 ?
You will need quotes for one. Then I think that it depends on the version of Python if the brackets are required or not!
ye i agree with Chris
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
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.
That's what I thought, seems better with the brackets
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.
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.
Join our real-time social learning platform and learn together with your friends!