You can download this file by right-clicking on the link in the navigation area. Do this, and open it in your text editor. Try the last function first. When you run it and it is correctly implemented, observe the test output that is printed. Writing test code like this is smart and it can save you from silly mistakes. In fact, it is a great idea to write the test code BEFORE you write the function. Be impish; try to break your work. But be fair: don't violate the preconditions.
#############################PROBLEM 1################################
def skippy(s):
"""precondtion: s is a string
postcondtion: returns every other character in s starting at index 0."""
pass
#############################PROBLEM 2################################
def perverse(s):
"""preconditon: s is a string
postcondition: returns a a string containing s's characters in
reverse order"""
pass
#############################PROBLEM 3################################
def innuendo(s):
"""precondition: s is a string
postcondition: returns s if s has six or fewer characers. Otherwise,
it returns a string containing the first three characers and the last
three characters of s."""
pass
#############################PROBLEM 4################################
def lopov(s, t):
"""precondition: s and t are strings.
postcondition: if t is not a substring of s, return s.
if t is a substring of s, return a string that contains s,
except that the first instance of t and all characters following
it are chopped off."""
pass
#############################PROBLEM 5################################
def vopol(s, t):
"""precondition: s and t are strings.
postcondition: if t is not a substring of s, return s.
if t is a substring of s, return a string that contains s,
except that the last instance of t and all characters following
it are chopped off."""
pass
#############################PROBLEM 6################################
def holy_rooted(n):
"""precondition: n is an integer and n >= 0
postcondition: return the integer square root of n.
examples
squarely(10) -> 3
squarely(200) -> 14
"""
pass
def main():
#test here
#testing is good. Here are free tests for holy_rooted
#I use tests like this to check your work.
x, y = 10, 3
print(f"Case x = {x} y = {y}:", end = "")
print("PASS" if (holy_rooted(x) == y) else "FAIL")
x, y = 200, 14
print(f"Case x = {x} y = {y}:", end = "")
print("PASS" if (holy_rooted(x) == y) else "FAIL")
x, y = 0, 0
print(f"Case x = {x} y = {y}:", end = "")
print("PASS" if (holy_rooted(x) == y) else "FAIL")
main()