Question: Using the provided code below, how can I implement the assertTrue or assertEqual function to handle the failed test? Failed test / error function to

Using the provided code below, how can I implement the assertTrue or assertEqual function to handle the failed test?
Failed test/ error function to be fixed:
ZigZag
Write a function zigzag that takes two parameters, a string, and an integer k.It should return a string that has the parameter string spanning k lines in a zig-zag pattern. You may assume the string is all on one line and has letters, digits, punctuation, and spaces only. So tabs,newlines, 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 =3should return the string:
Z a r
i Z g t i g
g S n
Provided Code:
# Uses the import function to import unittest module
import unittest
# Creates a class called TestFunctions from unittest module
# Utilizes the unittest framework
class TestFunctions(unittest.TestCase):
# Creates a function called test_is_prime, pass one parameter called self
# Tests for prime numbers
def test_is_prime(self):
# Utilizes the assertTrue or assertFalse to test the boolen logic of a given integer
# Tests whether the integer is prime or composite number
self.assertTrue(is_prime(2))
self.assertTrue(is_prime(3))
self.assertTrue(is_prime(5))
self.assertTrue(is_prime(7))
self.assertTrue(is_prime(11))
self.assertFalse(is_prime(-1))
self.assertFalse(is_prime(4))
self.assertFalse(is_prime(6.0))
self.assertFalse(is_prime(9))
self.assertFalse(is_prime(7500))
# Creates a function called test_is_anagram, pass one parameter called self
# Tests two strings to determine if they are anagrams
def test_is_anagram(self):
# Utilizes the assertTrue or assertFalse to test the boolen logic for the given strings
# Tests whether the strings are anagrams
self.assertTrue(is_anagram("listen", "silent"))
self.assertTrue(is_anagram("triangle", "integral"))
self.assertFalse(is_anagram("apple", "pale"))
self.assertFalse(is_anagram("hello", "bello"))
self.assertTrue(is_anagram("Clint Eastwood", "Old West Action"))
# Creates a function called test_is_anagram_set, pass one parameter called self
# Tests a list of strings to determine if they are anagrams
def test_is_anagram_set(self):
# Utilizes the assertTrue or assertFalse to test the boolen logic for a given list of strings
# Tests whether the strings are anagrams
self.assertTrue(is_anagram_set(["listen", "silent", "enlist"]))
self.assertTrue(is_anagram_set(["triangle", "integral"]))
self.assertFalse(is_anagram_set(["apple", "pale"]))
self.assertTrue(is_anagram_set(["Clint Eastwood", "Old West Action"]))
self.assertFalse(is_anagram_set(["hello", "bello", "mellow"]))
# Creates a function called test_is_palindrome, pass one parameter called self
# Tests a word or phrase to determine if the string(s) are palindrome
def test_is_palindrome(self):
# Utilizes the assertTrue or assertFalse to test the boolen logic for a given string(s)
# Tests whether the strings are palindromes
self.assertFalse(is_palindrome("A man, a plan, a canal, Panama"))
self.assertTrue(is_palindrome("racecar"))
self.assertFalse(is_palindrome("hello"))
self.assertTrue(is_palindrome("Was it a car or a cat I saw"))
self.assertTrue(is_palindrome("No lemon, no melon"))
# Creates a function called test_zigzag, pass one parameter called self
# Tests a string and integer value
def test_zigzag(self):
# Utilizes the assertTrue or assertFalse
ZigZag
Write a function zigzag that takes two parameters, a string, and an integer k.It should return a string that has the parameter string spanning k lines in a zig-zag pattern. You may assume the string is all on one line and has letters, digits, punctuation, and spaces only. So tabs,newlines, 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 =3should 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!