[Tutor] help

2019-02-05 Thread Sonia Miglani
Hi Team, I am learning puthon and trying the following code. But getting the following error. Please help me in knowing the code in better way. OS Linux Python version 2.7.13 def demo(s, exclaim): #""" # Returns the string 's' repeated 3 times. # If exclaim is true, add exclamati

Re: [Tutor] help

2019-02-05 Thread Alan Gauld via Tutor
On 05/02/2019 12:32, Sonia Miglani wrote: > OS Linux > Python version 2.7.13 Can you tell us how you are creating the file? Which editor are you using? It looks like there may be some spurious characters in your file. > def demo(s, exclaim): > #""" > # Returns the string 's' repeated 3 t

Re: [Tutor] help

2019-02-05 Thread Peter Otten
Sonia Miglani wrote: > Hi Team, > > I am learning puthon and trying the following code. > > But getting the following error. > > Please help me in knowing the code in better way. > > > OS Linux > Python version 2.7.13 > > > > def demo(s, exclaim): > #""" > # Returns the string 's'

Re: [Tutor] help

2019-02-05 Thread Mats Wichmann
>> Error: >> ./python2.py: line 1: syntax error near unexpected token `(' > > That is not a Python error, that's a complaint of your shell. > If you make a Python script executable you also have to insert the proper > hash-bang line. In the case of Python 2 > > #!/usr/bin/python2 > > will pro

Re: [Tutor] help

2019-02-05 Thread Alan Gauld via Tutor
On 05/02/2019 14:15, Peter Otten wrote: >> Error: >> ./python2.py: line 1: syntax error near unexpected token `(' > > That is not a Python error, that's a complaint of your shell. Oh, good catch Peter. I never noticed the start of the line I just read the text and saw the weird backtick... --