Answered step by step
Verified Expert Solution
Link Copied!

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 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

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

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions

Question

5. Explain the supervisors role in safety.

Answered: 1 week ago