Question

In: Computer Science

Python 3 Forming Functions Define and complete the functions described below. * function name: say_hi *...

Python 3 Forming Functions

Define and complete the functions described below.
* function name: say_hi
* parameters: none
* returns: N/A
* operation:
just say "hi" when called.
* expected output:

>>> say_hi()
hi


* function name: personal_hi
* parameters: name (string)
* returns: N/A
* operation:
Similar to say_hi, but you should include the name argument in the greeting.
* expected output:

>>> personal_hi("Samantha")
Hi, Samantha


* function name: introduce
* parameters: name1 (string)
name2 (string)
* returns: N/A
* operation:
Here you are simply including the two names in a basic introduction.
* expected output:

>>> introduce("Samantha","Jerome")
Samantha: Hi, my name is Samantha!
Jerome: Hey, Samantha. Nice to meet you. My name is Jerome.

Solutions

Expert Solution

/* PLEASE INDENT CODE USING SCREENSHOT TO RUN WITHOUT ERROR */

Define and complete the functions described below.
* function name: say_hi
* parameters: none
* returns: N/A

Ans.

def say_hi():
print("hi")

say_hi()

* function name: personal_hi
* parameters: name (string)
* returns: N/A
* operation:

Ans.

def personal_hi(name):
print("Hi, {}".format(name))

personal_hi("Samantha")

* function name: introduce
* parameters: name1 (string)
name2 (string)
* returns: N/A
* operation:

Ans.)

def introduce(name1,name2):
print("{}: Hi, my name is {}!".format(name1,name1))
print("{}: Hey, {}. Nice to meet you. My name is {}.".format(name2,name1,name2))

introduce("Samantha","Jerome")

/* PLEASE UPVOTE */


Related Solutions

Python 3 Functions that give answers Define and complete the functions described below. * function name:...
Python 3 Functions that give answers Define and complete the functions described below. * function name: get_name * parameters: none * returns: string * operation: Here, I just want you to return YOUR name. * expected output: JUST RETURNS THE NAME...TO VIEW IT YOU CAN PRINT IT AS BELOW >>> print(get_name()) John * function name: get_full_name * parameters: fname (string) lname (string) first_last (boolean) * returns: string * operation: Return (again, NOT print) the full name based on the first...
''' Problem 1: Formin' Functions Define and complete the functions described below. The functions are called...
''' Problem 1: Formin' Functions Define and complete the functions described below. The functions are called in the code at the very bottom. So you should be able simply to run the script to test that your functions work as expected. ''' ''' * function name: say_hi * parameters: none * returns: N/A * operation: Uhh, well, just say "hi" when called. And by "say" I mean "print". * expected output: >>> say_hi() hi ''' ''' * function name: personal_hi...
Use Python for this quetions: Write a python functions that use Dictionary to: 1) function name...
Use Python for this quetions: Write a python functions that use Dictionary to: 1) function name it addToDictionary(s,r) that take a string and add it to a dictionary if the string exist increment its frequenc 2) function named freq(s,r) that take a string and a record if the string not exist in the dictinary it return 0 if it exist it should return its frequancy.
python 3 please Define a function voweliest that takes as input a string and returns as...
python 3 please Define a function voweliest that takes as input a string and returns as output a tuple where the string that has the most vowels in it is the first element and the second is the number of vowels in that string. Note: don't worry about ties or capital letters Hint: consider defining and using a separate function that counts the number of vowels in a given string
Write code in Python: The edge-detection function (detectEdges) described in Chapter 7 and shown below returns...
Write code in Python: The edge-detection function (detectEdges) described in Chapter 7 and shown below returns a black and white image. Think of a similar way to transform color values so that the new image is still in its original colors but the outlines within it are merely sharpened. Then, define a function named sharpen that performs this operation. The function should expect an image and two integers as arguments. One integer should represent the degree to which the image...
Please answer using python 3 and def functions! Lab 2 Drill 3: (function practice) create and...
Please answer using python 3 and def functions! Lab 2 Drill 3: (function practice) create and use a function named highest() that takes three inputs and returns the highest number. After you have got it working, try calling the function with inputs ‘hat’, ‘cat’, ‘rat’.
Write python 3 code to define a function that uses three arguments, and returns a result....
Write python 3 code to define a function that uses three arguments, and returns a result. The function returns True if the first argument is more than or equal to the second argument and less than or equal to the third argument, otherwise it returns False. Write a python 3 code for function main, that does the following: creates a variable and assign it the value True. uses a while loop which runs as long as the variable of the...
In PYTHON 3 using functions. Per the client, you have the following information:  customer name, burger choice,...
In PYTHON 3 using functions. Per the client, you have the following information:  customer name, burger choice, time of purchase, and total bill. By the end of the day, your program will provide the following information: 1. Top three best clients with the highest spending 2. Name of client with second to last lowest bill 3. busiest hour of the day based on number of clients Assumptions 1. Your program will not handle more than 100 clients per day 2. The...
(Python) Define a function makeTwoWay that expects a singly linked structure as its argument. The function...
(Python) Define a function makeTwoWay that expects a singly linked structure as its argument. The function builds and returns a doubly linked structure that contains the items in the singly linked structure. (Note: The function should not alter the argument's structure.) node.py source code: """ File: node.py Node classes for one-way linked structures and two-way linked structures. """ class Node(object):     def __init__(self, data, next = None):         """Instantiates a Node with default next of None"""         self.data = data...
WHat are the major functions of the respiratory system? name and define the four process of...
WHat are the major functions of the respiratory system? name and define the four process of respiration
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT