FUNCTIONS ADRI JOVIN J J ASSISTANT PROFESSOR (SR. GR.) DEPARTMENT OF INFORMATIONTECHNOLOGY SRI RAMAKRISHNA INSTITUTE OFTECHNOLOGY Seven Days Faculty Development and Training Programme on GE8151 - Problem Solving and Python Programming
WHO’S A GREATTEACHER? The mediocre teacher tells. The good teacher explains. The superior teacher demonstrates. The great teacher inspires. ―William ArthurWard 31/05/2018 FUNCTIONS-PYTHON | 2
OBJECTIVE Creating a simple function with a parameter Exploring functions with return values Creating functions with multiple parameters Control Flow/Sequence in Python 31/05/2018 FUNCTIONS-PYTHON | 3
EXPECTED LEARNING OUTCOMES Create functions with a parameter Create functions with a return value Create functions with multiple parameters Understand the control flow in Python 31/05/2018 FUNCTIONS-PYTHON | 4 Cognitive level expected: “apply”
RECOMMENDEDTEACHING-AID Jupyter Notebook - Open Source (requires Anaconda environment) http://notebooks.azure.com - Free cloud platform (requires Microsoft account, probably a hotmail.com/live.com account) Spyder – Open Source (requires Anaconda environment) 31/05/2018 FUNCTIONS-PYTHON | 5
LEARNING RESOURCES  Official Python 3 Documentation - https://docs.python.org/3/library/index.html  Dive Into Python - http://www.diveintopython3.net/  Think Python - http://greenteapress.com/wp/think-python-2e/  The Official PythonTutorial - https://docs.python.org/3/tutorial/  Learn Python the HardWay - http://learnpythonthehardway.org/book/  PEP 8 - https://www.python.org/dev/peps/pep-0008/  PythonTutor - http://www.pythontutor.com/  Reserved Keywords in Python - https://docs.python.org/3.0/reference/lexical_analysis.html#id8 [Don’t use] 31/05/2018 FUNCTIONS-PYTHON | 6
JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON | 7 http://notebooks.azure.com Log-in with a Microsoft ID like MSN/Hotmail/Live account Easy to access from any where 24x7 availability Easy transfer of notebooks
JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON | 8  Create Libraries  Clone Libraries  Libraries may contain number of Notebooks
JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON | 9  Create Libraries  Clone Libraries  Libraries may contain number of Notebooks  Jupyter Notebook format (.ipynb files)
JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON | 10  Create Libraries  Clone Libraries  Libraries may contain number of Notebooks  Jupyter Notebook format (.ipynb files)
JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON | 11  Creating a new Notebook  Click + symbol > Name the Notebook Here, it is “MY_FIRST_NOTEBOOK”  Click “New” Note: ItemType must be selected or the file will be blank
JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON | 12  Code Cell  Markdown Cell  Raw NBConvert Cell  Header Cell
RUNNING A CELL 31/05/2018 FUNCTIONS-PYTHON | 13 Methods for running the code in a cell  Click in the cell below and press "Ctrl+Enter" to run the code or  Click in the cell below and press "Shift+Enter" to run the code and move to the next cell  Menu: Cell...  > Run Cells runs the highlighted cell(s)  > Run All Above runs the highlighted cell and above  > Run All Below runs the highlighted cell and below
WORKING IN NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON | 14 EDIT MODE  text cells in editing mode show markdown code  Markdown cells keep editing mode appearance until the cell is run  code (python 3) cells in editing look the same after editing, but may show different run output  clicking another cell moves the green highlight that indicates which cell has active editing focus CELLS NEEDTO BE SAVED  the notebook will frequently auto save  best practice is to manually save after editing a cell using "Ctrl + S" or alternatively, Menu: File > Save and Checkpoint
ALTERING NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON | 15 ADD A CELL  Highlight any cell and then... add a new cell using Menu: Insert > Insert Cell Below or Insert Cell Above  Add with Keyboard Shortcut: "ESC + A" to insert above or "ESC + B" to insert below CHOOSE CELLTYPE  Format cells as Markdown or Code via the toolbar dropdown or Menu: Cell > CellType > Code or Markdown  Cells default to Code when created but can be reformatted from code to Markdown and vice versa CHANGE NOTEBOOK PAGE LANGUAGE  The course uses Python 3 but Jupyter Notebooks can be in Python 2 or 3 (and a language called R)  To change a notebook to Python 3 go to "Menu: Kernel > Change Kernel> Python 3"
FUNCTIONS WITH ARGUMENTS Functions are used for code tasks that are intended to be reused  Make code easier to develop and maintain  Python allows −User Defined Functions −Built-in Functions (e.g.: print()) 31/05/2018 FUNCTIONS-PYTHON | 16
FUNCTIONS WITH ARGUMENTS  print()can be called using arguments (or without) and sends text to standard output, such as the console.  print()uses parameters to define the variable arguments that can be passed to the Function.  print()defines multiple string/numbers parameters which means we can send a long list of arguments to print(), separated by commas. 31/05/2018 FUNCTIONS-PYTHON | 17
BASICS OF A USER DEFINED FUNCTION  define a function with def  use indentation (4 spaces)  define parameters  optional parameters  return values (or none)  function scope (basics defaults) 31/05/2018 FUNCTIONS-PYTHON | 18 def some_function() :
CERTAIN RULES  use a function name that starts with a letter or underscore (usually a lower-case letter)  function names can contain letters, numbers or underscores  parenthesis () follow the function name  a colon : follows the parenthesis  the code for the function is indented under the function definition (use 4 spaces for this course) 31/05/2018 FUNCTIONS-PYTHON | 19
SYNTAX def some_function(): #code the function tasks indented here 31/05/2018 FUNCTIONS-PYTHON | 20 The end of the function is denoted by returning to no indentation
EXAMPLE def say_hi(): print("Hello World!") print("say hi!") say_hi() 31/05/2018 FUNCTIONS-PYTHON | 21 Output: Hello World! say hi!
CALLING FUNCTIONS  Simple function can be called using the function name followed by parentheses 31/05/2018 FUNCTIONS-PYTHON | 22 print() Example: def say_hi(): print("Hello World!") print("say hi!") say_hi()
TESTTHIS… 31/05/2018 FUNCTIONS-PYTHON | 23 Test: def say_hi(): print("Hello World!") print("say hi!") def three_three(): print(33) # calling the functions say_hi() print() three_three()
TEST RESULT… 31/05/2018 FUNCTIONS-PYTHON | 24 Output: Hello World! say hi! 33
TASK 31/05/2018 FUNCTIONS-PYTHON | 25 Define and call a simple function shout() shout() prints the phrase with "!" concatenated to the end  takes no arguments  indented function code does the following  define a variable for called phrase and initialize with a short phrase  prints phrase as all upper-case letters followed by "!"  call shout at the bottom of the cell after the function def (Tip: no indentation should be used)
FUNCTION WITH PARAMETERS 31/05/2018 FUNCTIONS-PYTHON | 26  print()and type()are examples of built-in functions that have parameters defined  type() has a parameter for a Python Object and sends back the type of the object
ARGUMENTVS PARAMETER 31/05/2018 FUNCTIONS-PYTHON | 27  an argument is a value given for a parameter when calling a function  type is called providing an Argument - in this case the string "Hello"  Parameters are defined inside of the parenthesis as part of a function def statement  Parameters are typically copies of objects that are available for use in function code type(“Hello”) def say_this(phrase): print(phrase)
DEFAULT ARGUMENT 31/05/2018 FUNCTIONS-PYTHON | 28  Default Arguments are used if no argument is supplied  Default arguments are assigned when creating the parameter list def say_this(phrase = "Hi"): print(phrase) say_this() say_this("Hello") Hi Hello Hi Hello
TASK 31/05/2018 FUNCTIONS-PYTHON | 29 Define shout_this()and call with variable argument  define variable words_to_shout as a string gathered from user input()  Call shout_this() with words_to_shout as argument  get user input()for the string words_to_shout Hi Hello
FUNCTION WITH RETURNVALUE 31/05/2018 FUNCTIONS-PYTHON | 30 type()returns an object type type()can be called with a float the return value can be stored in a variable Hi Hello object_type = type(2.33)
FUNCTION WITH RETURNVALUE 31/05/2018 FUNCTIONS-PYTHON | 31 return keyword in a function returns a value after exiting the function Hi Hello def msg_double(phrase): double = phrase + " " + phrase return double
TASK 31/05/2018 FUNCTIONS-PYTHON | 32 Define function print_doctor() that takes a parameter name get user input for variable full_name call the function using full_name as argument print the return value Hi Hello
FUNCTION WITH MULTIPLE PARAMETERS 31/05/2018 FUNCTIONS-PYTHON | 33 Functions can have multiple parameters separated by commas Hi Hello def make_schedule(period1, period2): schedule = ("[1st] " + period1.title() + ", [2nd] " + period2.title()) return schedule student_schedule = make_schedule("mathematics", "history") print("SCHEDULE:", student_schedule)
TASK 31/05/2018 FUNCTIONS-PYTHON | 34 Define make_schedule()adding a 3rd period to  Start with the above example code  add a parameter period_3  update function code to add period_3 to the schedule  call student_schedule()with an additional argument such as 'science'  print the schedule Hi Hello
SEQUENCE/FLOW OF EXECUTION 31/05/2018 FUNCTIONS-PYTHON | 35 In programming, sequence refers to the order that code is processed Objects in Python, such as variables and functions, are not available until they have been processed Processing sequence flows from the top of a page of code to the bottom This often means that function definitions are placed at the beginning of a page of code Hi Hello
SEQUENCE/FLOW OF EXECUTION 31/05/2018 FUNCTIONS-PYTHON | 36 Hi Hello have_hat = hat_available('green') print('hat available is', have_hat) def hat_available(color): hat_colors = 'black, red, blue, green, white, grey, brown, pink' return(color.lower() in hat_colors) --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-1-95ed6a786fca> in <module>() ----> 1 have_hat = hat_available('green') 2 print('hat available is', have_hat) 3 def hat_available(color): NameError: name 'hat_available' is not defined In the statement have_hat = hat_available('green')the function hat_available()needs to be called after the function has been defined In the statement have_hat = hat_available('green') the function hat_available() needs to be called after the function has been defined
TASK 31/05/2018 FUNCTIONS-PYTHON | 37 Change the Sequence to fix the NameError Hi Hello have_hat = hat_available('green') print('hat available is', have_hat) def hat_available(color): hat_colors = 'black, red, blue, green, white, grey, brown, pink' return(color.lower() in hat_colors)
TASK 31/05/2018 FUNCTIONS-PYTHON | 38 Create and test market()  market()takes 2 string arguments: commodity & price  market returns a string in sentence form  gather input for commodity_entry and price_entry to use in calling market()  print the return value of market() Example of output: CommodityType: Basket costs Rs. 100/- Hi Hello
TRAINING WORKBOOK 31/05/2018 FUNCTIONS-PYTHON | 39 https://notebooks.azure.com/adrijovin/libraries/functions- ge8151 Hi Hello Disclaimer: All products and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. Jupyter is a registered U.S. Patent & Trademark Office of Project Jupyter, USA Python is a registered trademark of the Python Software Foundation, USA Microsoft Azure is a registered trademark of Microsoft Corporation, USA

Python - Functions - Azure Jupyter Notebooks

  • 1.
    FUNCTIONS ADRI JOVIN JJ ASSISTANT PROFESSOR (SR. GR.) DEPARTMENT OF INFORMATIONTECHNOLOGY SRI RAMAKRISHNA INSTITUTE OFTECHNOLOGY Seven Days Faculty Development and Training Programme on GE8151 - Problem Solving and Python Programming
  • 2.
    WHO’S A GREATTEACHER? Themediocre teacher tells. The good teacher explains. The superior teacher demonstrates. The great teacher inspires. ―William ArthurWard 31/05/2018 FUNCTIONS-PYTHON | 2
  • 3.
    OBJECTIVE Creating a simplefunction with a parameter Exploring functions with return values Creating functions with multiple parameters Control Flow/Sequence in Python 31/05/2018 FUNCTIONS-PYTHON | 3
  • 4.
    EXPECTED LEARNING OUTCOMES Createfunctions with a parameter Create functions with a return value Create functions with multiple parameters Understand the control flow in Python 31/05/2018 FUNCTIONS-PYTHON | 4 Cognitive level expected: “apply”
  • 5.
    RECOMMENDEDTEACHING-AID Jupyter Notebook -Open Source (requires Anaconda environment) http://notebooks.azure.com - Free cloud platform (requires Microsoft account, probably a hotmail.com/live.com account) Spyder – Open Source (requires Anaconda environment) 31/05/2018 FUNCTIONS-PYTHON | 5
  • 6.
    LEARNING RESOURCES  OfficialPython 3 Documentation - https://docs.python.org/3/library/index.html  Dive Into Python - http://www.diveintopython3.net/  Think Python - http://greenteapress.com/wp/think-python-2e/  The Official PythonTutorial - https://docs.python.org/3/tutorial/  Learn Python the HardWay - http://learnpythonthehardway.org/book/  PEP 8 - https://www.python.org/dev/peps/pep-0008/  PythonTutor - http://www.pythontutor.com/  Reserved Keywords in Python - https://docs.python.org/3.0/reference/lexical_analysis.html#id8 [Don’t use] 31/05/2018 FUNCTIONS-PYTHON | 6
  • 7.
    JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON| 7 http://notebooks.azure.com Log-in with a Microsoft ID like MSN/Hotmail/Live account Easy to access from any where 24x7 availability Easy transfer of notebooks
  • 8.
    JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON| 8  Create Libraries  Clone Libraries  Libraries may contain number of Notebooks
  • 9.
    JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON| 9  Create Libraries  Clone Libraries  Libraries may contain number of Notebooks  Jupyter Notebook format (.ipynb files)
  • 10.
    JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON| 10  Create Libraries  Clone Libraries  Libraries may contain number of Notebooks  Jupyter Notebook format (.ipynb files)
  • 11.
    JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON| 11  Creating a new Notebook  Click + symbol > Name the Notebook Here, it is “MY_FIRST_NOTEBOOK”  Click “New” Note: ItemType must be selected or the file will be blank
  • 12.
    JUPYTER NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON| 12  Code Cell  Markdown Cell  Raw NBConvert Cell  Header Cell
  • 13.
    RUNNING A CELL 31/05/2018FUNCTIONS-PYTHON | 13 Methods for running the code in a cell  Click in the cell below and press "Ctrl+Enter" to run the code or  Click in the cell below and press "Shift+Enter" to run the code and move to the next cell  Menu: Cell...  > Run Cells runs the highlighted cell(s)  > Run All Above runs the highlighted cell and above  > Run All Below runs the highlighted cell and below
  • 14.
    WORKING IN NOTEBOOK 31/05/2018FUNCTIONS-PYTHON | 14 EDIT MODE  text cells in editing mode show markdown code  Markdown cells keep editing mode appearance until the cell is run  code (python 3) cells in editing look the same after editing, but may show different run output  clicking another cell moves the green highlight that indicates which cell has active editing focus CELLS NEEDTO BE SAVED  the notebook will frequently auto save  best practice is to manually save after editing a cell using "Ctrl + S" or alternatively, Menu: File > Save and Checkpoint
  • 15.
    ALTERING NOTEBOOK 31/05/2018 FUNCTIONS-PYTHON| 15 ADD A CELL  Highlight any cell and then... add a new cell using Menu: Insert > Insert Cell Below or Insert Cell Above  Add with Keyboard Shortcut: "ESC + A" to insert above or "ESC + B" to insert below CHOOSE CELLTYPE  Format cells as Markdown or Code via the toolbar dropdown or Menu: Cell > CellType > Code or Markdown  Cells default to Code when created but can be reformatted from code to Markdown and vice versa CHANGE NOTEBOOK PAGE LANGUAGE  The course uses Python 3 but Jupyter Notebooks can be in Python 2 or 3 (and a language called R)  To change a notebook to Python 3 go to "Menu: Kernel > Change Kernel> Python 3"
  • 16.
    FUNCTIONS WITH ARGUMENTS Functionsare used for code tasks that are intended to be reused  Make code easier to develop and maintain  Python allows −User Defined Functions −Built-in Functions (e.g.: print()) 31/05/2018 FUNCTIONS-PYTHON | 16
  • 17.
    FUNCTIONS WITH ARGUMENTS print()can be called using arguments (or without) and sends text to standard output, such as the console.  print()uses parameters to define the variable arguments that can be passed to the Function.  print()defines multiple string/numbers parameters which means we can send a long list of arguments to print(), separated by commas. 31/05/2018 FUNCTIONS-PYTHON | 17
  • 18.
    BASICS OF AUSER DEFINED FUNCTION  define a function with def  use indentation (4 spaces)  define parameters  optional parameters  return values (or none)  function scope (basics defaults) 31/05/2018 FUNCTIONS-PYTHON | 18 def some_function() :
  • 19.
    CERTAIN RULES  usea function name that starts with a letter or underscore (usually a lower-case letter)  function names can contain letters, numbers or underscores  parenthesis () follow the function name  a colon : follows the parenthesis  the code for the function is indented under the function definition (use 4 spaces for this course) 31/05/2018 FUNCTIONS-PYTHON | 19
  • 20.
    SYNTAX def some_function(): #code thefunction tasks indented here 31/05/2018 FUNCTIONS-PYTHON | 20 The end of the function is denoted by returning to no indentation
  • 21.
    EXAMPLE def say_hi(): print("Hello World!") print("sayhi!") say_hi() 31/05/2018 FUNCTIONS-PYTHON | 21 Output: Hello World! say hi!
  • 22.
    CALLING FUNCTIONS  Simplefunction can be called using the function name followed by parentheses 31/05/2018 FUNCTIONS-PYTHON | 22 print() Example: def say_hi(): print("Hello World!") print("say hi!") say_hi()
  • 23.
    TESTTHIS… 31/05/2018 FUNCTIONS-PYTHON |23 Test: def say_hi(): print("Hello World!") print("say hi!") def three_three(): print(33) # calling the functions say_hi() print() three_three()
  • 24.
    TEST RESULT… 31/05/2018 FUNCTIONS-PYTHON| 24 Output: Hello World! say hi! 33
  • 25.
    TASK 31/05/2018 FUNCTIONS-PYTHON |25 Define and call a simple function shout() shout() prints the phrase with "!" concatenated to the end  takes no arguments  indented function code does the following  define a variable for called phrase and initialize with a short phrase  prints phrase as all upper-case letters followed by "!"  call shout at the bottom of the cell after the function def (Tip: no indentation should be used)
  • 26.
    FUNCTION WITH PARAMETERS 31/05/2018FUNCTIONS-PYTHON | 26  print()and type()are examples of built-in functions that have parameters defined  type() has a parameter for a Python Object and sends back the type of the object
  • 27.
    ARGUMENTVS PARAMETER 31/05/2018 FUNCTIONS-PYTHON| 27  an argument is a value given for a parameter when calling a function  type is called providing an Argument - in this case the string "Hello"  Parameters are defined inside of the parenthesis as part of a function def statement  Parameters are typically copies of objects that are available for use in function code type(“Hello”) def say_this(phrase): print(phrase)
  • 28.
    DEFAULT ARGUMENT 31/05/2018 FUNCTIONS-PYTHON| 28  Default Arguments are used if no argument is supplied  Default arguments are assigned when creating the parameter list def say_this(phrase = "Hi"): print(phrase) say_this() say_this("Hello") Hi Hello Hi Hello
  • 29.
    TASK 31/05/2018 FUNCTIONS-PYTHON |29 Define shout_this()and call with variable argument  define variable words_to_shout as a string gathered from user input()  Call shout_this() with words_to_shout as argument  get user input()for the string words_to_shout Hi Hello
  • 30.
    FUNCTION WITH RETURNVALUE 31/05/2018FUNCTIONS-PYTHON | 30 type()returns an object type type()can be called with a float the return value can be stored in a variable Hi Hello object_type = type(2.33)
  • 31.
    FUNCTION WITH RETURNVALUE 31/05/2018FUNCTIONS-PYTHON | 31 return keyword in a function returns a value after exiting the function Hi Hello def msg_double(phrase): double = phrase + " " + phrase return double
  • 32.
    TASK 31/05/2018 FUNCTIONS-PYTHON |32 Define function print_doctor() that takes a parameter name get user input for variable full_name call the function using full_name as argument print the return value Hi Hello
  • 33.
    FUNCTION WITH MULTIPLEPARAMETERS 31/05/2018 FUNCTIONS-PYTHON | 33 Functions can have multiple parameters separated by commas Hi Hello def make_schedule(period1, period2): schedule = ("[1st] " + period1.title() + ", [2nd] " + period2.title()) return schedule student_schedule = make_schedule("mathematics", "history") print("SCHEDULE:", student_schedule)
  • 34.
    TASK 31/05/2018 FUNCTIONS-PYTHON |34 Define make_schedule()adding a 3rd period to  Start with the above example code  add a parameter period_3  update function code to add period_3 to the schedule  call student_schedule()with an additional argument such as 'science'  print the schedule Hi Hello
  • 35.
    SEQUENCE/FLOW OF EXECUTION 31/05/2018FUNCTIONS-PYTHON | 35 In programming, sequence refers to the order that code is processed Objects in Python, such as variables and functions, are not available until they have been processed Processing sequence flows from the top of a page of code to the bottom This often means that function definitions are placed at the beginning of a page of code Hi Hello
  • 36.
    SEQUENCE/FLOW OF EXECUTION 31/05/2018FUNCTIONS-PYTHON | 36 Hi Hello have_hat = hat_available('green') print('hat available is', have_hat) def hat_available(color): hat_colors = 'black, red, blue, green, white, grey, brown, pink' return(color.lower() in hat_colors) --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-1-95ed6a786fca> in <module>() ----> 1 have_hat = hat_available('green') 2 print('hat available is', have_hat) 3 def hat_available(color): NameError: name 'hat_available' is not defined In the statement have_hat = hat_available('green')the function hat_available()needs to be called after the function has been defined In the statement have_hat = hat_available('green') the function hat_available() needs to be called after the function has been defined
  • 37.
    TASK 31/05/2018 FUNCTIONS-PYTHON |37 Change the Sequence to fix the NameError Hi Hello have_hat = hat_available('green') print('hat available is', have_hat) def hat_available(color): hat_colors = 'black, red, blue, green, white, grey, brown, pink' return(color.lower() in hat_colors)
  • 38.
    TASK 31/05/2018 FUNCTIONS-PYTHON |38 Create and test market()  market()takes 2 string arguments: commodity & price  market returns a string in sentence form  gather input for commodity_entry and price_entry to use in calling market()  print the return value of market() Example of output: CommodityType: Basket costs Rs. 100/- Hi Hello
  • 39.
    TRAINING WORKBOOK 31/05/2018 FUNCTIONS-PYTHON| 39 https://notebooks.azure.com/adrijovin/libraries/functions- ge8151 Hi Hello Disclaimer: All products and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. Jupyter is a registered U.S. Patent & Trademark Office of Project Jupyter, USA Python is a registered trademark of the Python Software Foundation, USA Microsoft Azure is a registered trademark of Microsoft Corporation, USA

Editor's Notes

  • #26 def yell_it(): phrase=input("Enter a word: ") print(phrase.upper()+"!") yell_it()
  • #27 def yell_it(): phrase=input("Enter a word: ") print(phrase.upper()+"!") yell_it()
  • #28 def yell_it(): phrase=input("Enter a word: ") print(phrase.upper()+"!") yell_it()
  • #29 def yell_it(): phrase=input("Enter a word: ") print(phrase.upper()+"!") yell_it()
  • #30 def yell_it(): phrase=input("Enter a word: ") print(phrase.upper()+"!") yell_it()
  • #31 def yell_it(): phrase=input("Enter a word: ") print(phrase.upper()+"!") yell_it()
  • #32 def yell_it(): phrase=input("Enter a word: ") print(phrase.upper()+"!") yell_it()
  • #33 def make_doctor(name): return "Dr. "+name full_name=input("Enter a name: ") print(make_doctor(full_name))
  • #34 def yell_it(): phrase=input("Enter a word: ") print(phrase.upper()+"!") yell_it()
  • #35 def make_doctor(name): return "Dr. "+name full_name=input("Enter a name: ") print(make_doctor(full_name))
  • #36 def make_doctor(name): return "Dr. "+name full_name=input("Enter a name: ") print(make_doctor(full_name))
  • #37 def make_doctor(name): return "Dr. "+name full_name=input("Enter a name: ") print(make_doctor(full_name))
  • #38 def make_doctor(name): return "Dr. "+name full_name=input("Enter a name: ") print(make_doctor(full_name))
  • #39 def make_doctor(name): return "Dr. "+name full_name=input("Enter a name: ") print(make_doctor(full_name))
  • #40 def yell_it(): phrase=input("Enter a word: ") print(phrase.upper()+"!") yell_it()