# -----------------------------------------------------
# -----------------------------------------------------
def windChill(airTemp, airSpeed):
"""
Given the temperature and wind speed, return the wind chill
using this formula
windChill = 35.74 + 0.6215 * airTemp
- 35.75 * airSpeed ** 0.16
+ 0.4275 * airTemp * airSpeed ** 0.16
The return value must be rounded to one decimal place
"""
# TODO: complete this function
return 9999 # Bogus value that does not work


# Test Code for function windChill
assert (windChill(32.0, 20.0) == 20.0)
assert (windChill(10.0, 15.0) == -6.6)
assert (windChill(0.0, 25.0) == -24.1)
assert (windChill(-10.0, 35.0) == -41.2)


# -----------------------------------------------------
# -----------------------------------------------------
def monkey_smiles(smile_a, smile_b):
"""
We have two monkeys, a and b, and the parameters smile_a
and smile_b indicate if each is smiling. We are in trouble
if they are both smiling or if neither of them is smiling.
Return true if we are in trouble.
monkey_smiles(True, True) return True
monkey_smiles(True, False) returns False
"""
# TODO: complete this function
return not True


# Test Code for function monkey_smiles:
assert (monkey_smiles(False, False))
assert (monkey_smiles(True, True))
assert (not monkey_smiles(True, False))
assert (not monkey_smiles(False, True))


# -----------------------------------------------------
# -----------------------------------------------------
def is_leap_year(year):
"""
Complete function isLeapYear that returns true if the integer
argument represents a leap year. A leap year is a positive integer
that is evenly divisible by 4 except the last year of a century,
which are those years evenly divisible by 100. These must also be
divisible by 400. 2000 was a leap year and 2100 will not be even
though 2100 is evenly divisible by 4.
isLeapYear(2008) returns true
isLeapYear(2009) returns false
isLeapYear(2000) returns true
isLeapYear(2100) returns false
Precondition: year >= 1582
"""
# TODO: complete this function
return not True # bogus return that does not work


# Test Code:
assert(is_leap_year(2020))
assert(not is_leap_year(2021))
assert(not is_leap_year(2022))
assert(not is_leap_year(2023))
assert(is_leap_year(2024))
assert(is_leap_year(2000))
assert(is_leap_year(2400))
assert(not is_leap_year(2100))
assert(not is_leap_year(2200))
assert(not is_leap_year(2300))


# -----------------------------------------------------
# -----------------------------------------------------
def smallLongSmall(a, b):
"""
You are given 2 strings, a and b. Return a string of the form
short+long+short with the shorter string on the outside and
the longer string on the inside. The strings will never be the
same length. Either string may be empty (len 0).

smallLongSmall("Hello", "hi") returns "hiHellohi"
smallLongSmall("hi", "Hello") returns "hiHellohi"
smallLongSmall("aaa", "b") returns "baaab"

Precondition: len(a) != len(b)
"""
# TODO: Complete this function.
# Use one if statement and two returns.
# Do not use else or elif!
return "Under construction"


# Test code
assert (smallLongSmall("Hello", "hi") == "hiHellohi")
assert (smallLongSmall("", "hi") == "hi")
assert (smallLongSmall("bb", "a") == "abba")
assert (smallLongSmall("b", "aa") == "baab")


# -----------------------------------------------------
# -----------------------------------------------------
def removeStart(a, b):
# Given two strings, concatenate them together and return
# the result. However, if the strings are different lengths, omit the
# beginning characters from the longer string so it is the same length
# as the shorter string. The strings may be any length.
# removeStart("Hello", "Hi") returns "loHi"
# removeStart("Hello", "java") returns "ellojava"
# removeStart("java", "Hello") returns "javaello"
# TODO: Complete this method.
# You will need more than 1 if statement more than 1 return.
return 'Under Construction'


# Test Code
assert(removeStart("same", 'lens') == "samelens")
assert(removeStart("Hello", "Hi") == "loHi")
assert(removeStart("Hi", "Hello") == "Hilo")
assert(removeStart("Hi", "Hello") == "Hilo")
assert(removeStart("", "Hello") == "")
assert(removeStart("Hello", "") == "")
assert(removeStart("abcdef", "123") == "def123")
assert(removeStart("123", "abcdef") == "123def")


# -----------------------------------------------------
# -----------------------------------------------------
def largest(a, b, c):
"""
You are given three numbers as arguments. Return the number that
is greater than (or equal to) the other two numeric arguments

largest(1, 2, 3) returns 3
largest(-1, 1, -3) returns 1

Precondition: All three arguments are always valid numbers, int or float
"""
# TODO: Complete this function.
# You may need more than 1 if statement and/or 1 or more returns.
return 9999 # a bogus value that does not work


# Test code for largest
assert(largest(1, 2, 3) == 3)
assert(largest(1, 3, 3) == 3)
assert(largest(3, 3, 1) == 3)
assert(largest(3.0, 3, 3.0) == 3)
assert(largest(-99.0, -99, 99.0) == 99)
assert(largest(-1.0, -1, -1.0) == -1)
assert(largest(3.0, 3, 3.0) == 3)
assert(largest(997, 998, 999) == 999)


# ---------------------------------------------------------
# ---------------------------------------------------------
def one_two(word):
"""
You are given a string name word.
If the string BEGINS with "o" return "one".
If the string ENDS with "t" return "two".
If BOTH the "o" and "t" conditions are true, return "onetwo".
If NEITHER the "o" and "t" conditions are true, return the string unchanged.

one_two("only one") returns "one"
one_two("cart") returns "two"
one_two("oft") returns "onetwo"
one_two("abcde") returns "abcde"
"""
# TODO: Complete this function.
# You will need more than one if statement and return statements
#
# Precondition: The string argument is always lowercase and len(word) >= 2
return "Under construction"


# Test Code for one_two
assert(one_two("only") == "one")
assert(one_two("cart") == "two")
assert(one_two("o+++t") == "onetwo")
assert(one_two("t+++o") == "t+++o")
assert(one_two("no match") == "no match")
assert(one_two("ot") == "onetwo")
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.