Difference between revisions of "Python Functions"

From rbachwiki
Jump to navigation Jump to search
(Created page with " def addnum(a,b): result = a +b return result print addnum(4,5) Problem: find out if the word "dog" is in a string def dog(mystring): return 'dog' in mystring.low...")
(No difference)

Revision as of 21:56, 2 February 2019

def addnum(a,b):
   result = a +b
   return result
print addnum(4,5)

Problem: find out if the word "dog" is in a string

def dog(mystring):
  return 'dog' in mystring.lower():
dog('dog ran away')
true