Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Hello, please provide step-by-step instructions along with the answer. Question 1: Prohibited Character in a String (2 points) on Unix systems (as Occasionally, we might
Hello, please provide step-by-step instructions along with the answer.
Question 1: Prohibited Character in a String (2 points) on Unix systems (as Occasionally, we might want to restrict what characters a person can enter into a program--for instance, file names cannot contain these are used to separate paths), and many websites will not allow you to put spaces in your passwords. Write a program that, given a string, s, and a single character, c, determines if the string is valid (that is, string s does not contain the exact character c). Your program should return False if c is in s , and True otherwise. In [66]: def prohibitedCharacter(s, c): return ans In [67]: # Your Provided Sample Test Cases print("#1", prohibitedCharacter('I\'d like to teach the world to sing!', 'T') == True) #notice it is case sensitive print("#2", prohibitedCharacter('www.cas.mcmaster.ca', 'S') == True) print("#3", prohibitedCharacter('tom_cruise! @mcmaster.ca', '!') == False)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