[Tutor] help
Sonia Miglani
sonia.miglani33 at gmail.com
Tue Feb 5 07:32:34 EST 2019
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 exclamation marks.
result = s + s + s
if exclaim:
result = result + '!!!'
return result
def main():
print demo('Yay', False) ## YayYayYay
print demo('Woo Hoo', True) ## Woo HooWoo HooWoo Hoo!!!
Error:
./python2.py: line 1: syntax error near unexpected token `('
./python2.py: line 1: `def demo(s,exclaim):
Regards
Sonia
More information about the Tutor
mailing list