Question: In Python 3.6 Question 1 for strings a) Write a function named longest_common_prefix that takes two strings and returns the longest common prefix of the

In Python 3.6

Question 1 for strings

a) Write a function named longest_common_prefix that takes two strings and returns the longest common prefix of the two strings. For example, the longest common prefix of distance and disinfection is dis. If the two strings have no common longest common prefix, the method returns an empty string.

b) Write a function named reverse that takes a string argument and returns its reverse. For example, reverse(I am testing) should return the string gnitset ma I. Use iteration for this and answers using slicing will not be accepted. Imma like... what.

c) Write a function named check_password that checks whether a string is a valid password. Return True if it is a valid password and False otherwise. The password rules are as follows:

A password must have at least 8 characters.

A password must consist of only letters and digits.

A password must contain at least two digits.

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 Databases Questions!