Python Functions

From rbachwiki
Revision as of 21:56, 2 February 2019 by Bacchas (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
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