Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 qpy 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
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
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