Question: Write a program stored in a file q 5 . py that asks the user to enter a string and performs the following tasks. Checks

Write a program stored in a file q5.py that asks the user to enter a string and performs the
following tasks.
Checks if the string follows all the constrains given below otherwise it prints "Invalid String"
and terminates:
The length is equal to 6
It starts with an Upper Case letter
Every letter is followed by one number
A letter cannot be followed by a letter
A number cannot be followed by a number
String ends with !
Extract only the letters from the string and store it in a variable and print the variable
Extract only the numbers from the string and store it in a variable
Store all the positive divisors of the number in an array and print the array.
If the number is prime, print YES otherwise NO.

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!