Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python3 I have to use a docstring in every function. (1) OK or Not OK? (a) Write a function, checklen, that has two parameters, astring,

Python3

I have to use a docstring in every function.

(1) OK or Not OK?

(a) Write a function, checklen, that has two parameters, astring, of type string and le, an integer, that returns True if astring is le characters long, and False otherwise.

(b) Write a function, is_nonalnum, that takes one input parameter, astring, of type string and returns True if astring contains at least one non-alphanumeric character, and False otherwise. (HINT: Investigate string method isalnum.)

(c) Write a function, is_noEe, that takes one input parameter, astring, of type string and returns True if astring does NOT contain the characters 'E' or 'e', and False otherwise.

(d) Define a function, is_uc_alpha, with one parameter, astring, which returns True if any character in astring is an uppercase letter and returns False otherwise. (HINT: Look at each character in the string separately, using an appropriate string method, e.g., isupper.)

(e) Define a function, is_2numbers, with one parameter, astring, which returns True if astring has at least two numbers, and otherwise returns False. (HINT: Look at each character in the string separately, using an appropriate string method, e.g., isdigit).

(f) Define a function, is_special_char, with one parameter, astring, which returns True if astring contains any of the special characters, '!', '@', '#', '$', '%', '^', '&', and otherwise returns False. (HINT: Define a string variable which has the value of a string containing all of the special characters.)

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_2

Step: 3

blur-text-image_3

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

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions

Question

b. Did you suppress any of your anger? Explain.

Answered: 1 week ago

Question

=+C&B (especially taxation) laws, regulations, and practices?

Answered: 1 week ago

Question

=+designing international assignment C&B packages.

Answered: 1 week ago