Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a function called tax_cost that accepts one parameter which represents a dollar amount before tax. The function should return the total amount

image


1. Write a function called tax_cost that accepts one parameter which represents a dollar amount before tax. The function should return the total amount that will be charged, including the tax. You should assume a tax rate of 13%. Example: If the dollar amount before tax is 2.00, then the total amount returned will be 2.26 2. Write a function called double_lis that accepts one list of numbers as a parameter. The function should return the list with all elements of the list doubled. It should NOT modify the parameter list. Example: if the list is [1,2,3,4] then the function will return [2,4,6,8]. However, if you print the list that was used as a parameter after calling the function with it, it will still produce the values [1,2,3,4]. 3. Write a function called sheep_goat that returns True if the string "sheep" and "goat" appear the same number of times. The function will accept one string as a parameter. Example: if the string is "sheepgoat" the function will return True because "sheep" and "goat" both appear exactly once in the string. If the string was "sheepsheep" then the function will return False because "sheep" appears twice, but "goat" appears 0 times. 4. Write a function called second half that accepts a string of even length as input parameter (string length could be 2, 4, 6, or so on). The function should return the second half of the string. Example: if the string is "Hello There" then the function just returns "There". If the string is "ToGo" then the function returns "Go". 5. Write a function called add_pairs that accepts two lists of integers as parameters. The function should return a new list that adds the pairs of integers from each list. You may assume that both lists are the same length, meaning you will always have equal pairs.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions