Question

Greeter Write a function that takes in a person's name, and prints out a greeting. The...

Greeter

  • Write a function that takes in a person's name, and prints out a greeting.
  • The greeting must be at least three lines, and the person's name must be in each line.
    • example:
      • Hello name
      • How are you do name
      • Nice to meet you name
  • Use your function to greet at least three different people.

Full Names

  • Write a function that takes in a first name and a last name, and prints out a nicely formatted full name, in a sentence. Your sentence could be as simple as, "Hello, full_name."
  • Call your function three separate times, utilizing different names each time.

Addition Calculator

  • Write a function that takes in two numbers, and adds them together. Make your function print out a sentence showing the two numbers, and the Total.
  • Call your function three separate times with three different sets of numbers.

Create a Module that will import the above Functions and run those functions from within the file

  • Save the file as  yourLastname_ ImportFile.py
0 0
Add a comment Improve this question Transcribed image text
Answer #1

basic.py

def greeter(name):
    print('Hello', name)
    print('How are you do', name)
    print('Nice to meet you', name)


def fullnames(first_name, last_name):
    print('Hello,', first_name + '_' + last_name+'.')


def add(num1, num2):
    total = num1 + num2
    print('Number 1:', num1)
    print('Number 2:', num2)
    print('Total:', total)

SCREENSHOT-

yourLastname_ ImportFile.py

# Import functions separately
from basic import greeter
from basic import fullnames
from basic import add

# Or Import all functions
# from basic import *


# Test Greeter function
greeter('Jane Doe')
print()
greeter('Jack')
print()
greeter('Alexander M. Willis')
print()

# Test fullnames function
fullnames('Jane', 'Doe')
fullnames('Alex', 'Calvert')
fullnames('Max', 'Jay')
print()

# Test add function
add(2, 5)
print()
add(100, 999)
print()
add(20, -40)

SCREENSHOT-

OUTPUT-

Add a comment
Know the answer?
Add Answer to:
Greeter Write a function that takes in a person's name, and prints out a greeting. The...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c++ language 1) Create a function that prints a greeting when called with a name such...

    c++ language 1) Create a function that prints a greeting when called with a name such as greeting ("Elona") 2) Create a function that squares a double number and returns the result as a double. 3) Create a function that takes 5 int numbers and returns the average as a float 4) Create a single function that gives a greeting, calculates the average of 5 grades but does not return a value. Hint: Use return type void and a string...

  • Write a function full_name(first_name, last_name) that takes a person's first name and last name as parameters...

    Write a function full_name(first_name, last_name) that takes a person's first name and last name as parameters and returns their full name made up of the first name, a space character and their last name all concatenated together. For example: Test Result name = full_name('Alex', 'Ng') print(name) Alex Ng print(full_name('Malcolm', 'X')) Malcolm X

  • write a static method named greet that takes a String that represents a name and prints...

    write a static method named greet that takes a String that represents a name and prints a personalized greeting to StdDraw. So far i have in the main method... 4 public class TakeHomeAssignment 5 { 6 public static void main(String[] args) 7 { 8 StdDraw.setScale(0,500); 9 //drawEye(250,250,50); 10 String greet(Aaron); 11 // drawStickFigure(250,250); and for the method; //public static String greet( name) 31 //{ 32 33 34 //StdDraw.text(250,250,"Hello" +name); 35 36 // } Im getting errors saying its an illegal...

  • Please Use Python and provide explanations!!!! 1. Write a function called multiply_and_print that takes two numbers,...

    Please Use Python and provide explanations!!!! 1. Write a function called multiply_and_print that takes two numbers, multiplies them together, and prints out the sentence '____ times ____ is ____'. Ask the user for two numbers, and call multiply_and_print with their two numbers as arguments. 2.Write a function called roll_dice that rolls two six-sided dice and prints out the result of each die. Call it three times. (Remember, you can import the random module with the statement import random, and then...

  • IN PYTHON Implement a function printSeqs() that accepts a list of name lst and prints the...

    IN PYTHON Implement a function printSeqs() that accepts a list of name lst and prints the following sequences. The sequences are printed by the for loops found in the function. The information below shows how you would call the function printSeqs() and what it would display: Write a for loop that iterates through a list of names and print a greeting for each name in the list. Request from the user a positive integer n and prints all the positive...

  • C++ 9) Write a recursive function printAll that takes an int num argument and prints all...

    C++ 9) Write a recursive function printAll that takes an int num argument and prints all the numbers in the range [num, 0]. The function returns nothing. e.g. printAll(5) prints 5, 4, 3, 2, 1, 0. Call your function in the main

  • Guessing one password: write a function called guess that takes a string (a guessed password) as an argument and prints out matching information if its encrypted string matches any of the strings in t...

    Guessing one password: write a function called guess that takes a string (a guessed password) as an argument and prints out matching information if its encrypted string matches any of the strings in the encrypted password file. When you write the function, you may hardcode the name of the password file. Here is an example run: >>> guess("blue") Found match: blue Line number: 1 Encrypted value: 16477688c0e00699c6cfa4497a3612d7e83c532062b64b250fed8908128ed548 You will want to use the encrypt function presented in class: import hashlib...

  • PYTHON Programming short Questions: 1. Write a function takes as input name (string) and age (number)...

    PYTHON Programming short Questions: 1. Write a function takes as input name (string) and age (number) and prints: My name is <name> and I am <age> years old(where name and age are the inputs) 2. Write a function that takes as input a and b and returns the result of: ??ab 3. Write a function that takes as input a and b and returns the result of: ??ab if it is valid to divide a and b 4. Write a...

  • C++ 2. (a) Write a function, printdixisors, that takes a single integer parameter and prints all...

    C++ 2. (a) Write a function, printdixisors, that takes a single integer parameter and prints all the numbers less that the parameter that are divisors of the parameter (i.e. divides it without a remainder) including 1. So printdivisors(6) will print 1,2,3. Note you may use a wrapper function or default parameters. (b) Write a function, sumdixisors, that takes a single integer parameter and returns the sum of all the divisors of the parameter (including 1). So sumdivisors(6) will return 6...

  • 1. Write a C++ program to output a framed greeting. The program will produce five lines...

    1. Write a C++ program to output a framed greeting. The program will produce five lines of output. The first line begins the frame. It is a sequence of * characters as long as the person's name, plus some characters to match the salutation ("Hello, "), plus a space and an * at each end. The line after that will be an appropriate number of spaces with an * at each end. The third line is an *, a space,...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT