Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please have detailed explanations beside each code. Thank you. Occasionally, we might want to restrict what characters a person can enter into a program--for instance,

Please have detailed explanations beside each code. Thank you.image text in transcribed

Occasionally, we might want to restrict what characters a person can enter into a program--for instance, file names cannot contain / on Unix systems (as 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 [ ]: def prohibitedCharacter(s, c): # Your code here. return ans In [ ]: # 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', '$') == True) print("#3", prohibitedCharacter('tom_cruise! @mcmaster.ca', '!') == false)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions

Question

LO 4-3 Describe managements role in setting ethical standards.

Answered: 1 week ago

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

How do you determine the load-bearing capacity of a soil?

Answered: 1 week ago

Question

what is Edward Lemieux effect / Anomeric effect ?

Answered: 1 week ago