Wednesday, 4 January 2017

PYTHON -string & command lines

>>> word1="good"

ERROR:

>>> w2=good
Traceback (most recent call last):
  File "<pyshell#68>", line 1, in <module>
    w2=good
NameError: name 'good' is not defined

PROPER WAY TO USE STRINGS

>>> w1="good"
>>> w2="morning"
>>> s1=w1+""+w2

>>> print(s1);
goodmorning

>>> s1=w1+"   "+w2
>>> print(s1)
good   moring

COMMAND LINE


>>> #print("fsdkncks")
>>> #print("this is command line this wont print in console")

No comments:

Post a Comment