Question: Hello, I need help writing a program in Python: Instructions: Write a series of functions and testing functions. Your program when executed, with all of
Hello, I need help writing a program in Python:
Instructions:
Write a series of functions and testing functions. Your program when executed, with all of the tests should run and no output generated.
Your tests will cover all of the functionality of the function and a range of the types. For instance, if you have a conditional statement, you should have a test that takes the true branch and another that takes the false branch. You should have at least different tests per function.
Primality Testing:
Write a function isprime that takes in an int parameter and returns a bool if the number is prime. The function should use nave trial division with the acceleration that prime numbers other than or are not multiples of or Similar to the characterization of the primes modulo ie This means your primary divisor loop should skip in multiples of known as optimization. It is ok to research this optimization, make sure to cite any references you use. You need to exhaustively test your function for every number below You should have five tests in total.
Anagrams Testing:
An anagram is a set of two or more words or phrases that use the same letters. Write two complementary functions, isanagram which takes in two strings, and isanagramset which takes in a set of strings. Both functions should return True only if all of the strings are mutually anagrams. They should return False otherwise. Your isanagramset should use isanagram in its implementation. Only letters are considered for anagrams. Spaces and punctuation are ignored. You should have five tests for isanagram and five tests for isanagramset.
Palindromes Testing:
A palindrome is a word or phrase that uses the same letters forward and backward. Write a function ispalindrome that returns True or False as appropriate. Again, only letters are considered for anagrams. Spaces and punctuation are ignored. You should have five tests in total.
ZigZag
Write a function zigzag that takes two parameters, a string, and an integer kIt should return a string that has the parameter string spanning k lines in a zigzag pattern. You may assume the string is all on one line and has letters, digits, punctuation, and spaces only. So tabsnewlines and other control characters are excluded. Note this should be one long string, so use
where needed.
For example, with the input "ZigZagString" and k should return the string:
Z a r
i Z g t i g
g S n
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
