Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a group of required functions for text processing in the script p5.py. The input test_string should be a single string. Implement the count_digit
Write a group of required functions for text processing in the script p5.py. The input test_string should be a single string. Implement the count_digit (test_string) function and return the number of digital char- acters 0-9 in the test_string. Implement the check_isogram (test_string) function and return the bool variable to indicate whether test_string has duplicate letters. If test_string is an isogram, then the function returns True. If test_string is not an isogram, then the function returns False. Implement the join(original_string, inserted_list) function and return a new string which made by joining characters in Inserted_list with original_string inserted between every element. Implement the search (test_string, sub) function and return the highest index in test_string where substring sub is found. If not found, it returns -1. Testing: Suppose you saved your script p5.py in C:\Users\USERNAME\Documents\lab2. In IDLE, you should test your script p5.py in the Python shell with >>> import sys >>> sys.path.append(r"C:\Users\USERNAME\Documents\lab2") >>> import p5 >>> test_str = "Alice was born in 2000 and born in hong kong." >>> p5.count_digit (test_str) 4 >>> p5.check_isogram(test_str) False >>> p5.search(test_str, "born") 27 >>>p5.search(test_str, "now") -1 >>> p5.join('-', ['a','b', 'c']) 'a-b-c'
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started