Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A) Gets two inputs from the user. Stores the inputs in variables called string_one and string_two. Verifies whether the length is according to the constraints

image text in transcribedimage text in transcribed

A) Gets two inputs from the user. Stores the inputs in variables called string_one and string_two. Verifies whether the length is according to the constraints and prints the verification result. Certain constraints are imposed on the input pattern. The constraints are: For the first input : The input starts with a letter. Every letter is followed by exactly one number. A letter cannot be next to another letter. A number cannot be next to another number. The length should be 5. The input is made of only numbers and letters. This means tha input should not conta any symbols or special characters. For the second input: The input starts with a number. Every number is followed by exactly one letter. A number cannot be next to another number. A letter cannot be next to another letter. The length should be 7. The input is made of only numbers and letters. This means the input should not contain any symbols or special characters. B) Extracts only the numbers from the variable string_one and stores it in a variable called numbers_one and extracts only the letters from the variable string_one and stores it in a variable called letters_one. Prints numbers_one and letters_one. C) Extracts only the numbers from the variable string_two and stores it in a variable called numbers_two, and extracts only the letters from the variable string_two and stores it in a variable called letters_two. Prints numbers_two and letters_two. D) Calculates the quotient and remainder when numbers_two is divided by numbers_one and stores it in a variable called quotient1 and remainder1 respectively. Print quotient1 and remainderi. E) Concatenates letters_two with letters_one and stores it in a variable called result1. Print resulti. Sample Output: 1. *******Section A*** 2. Enter the first input: d402g 3. Enter the second input: 2e0w2e1 Is the length of string_one equal to 5? True Is the length of string_two equal to 7? : True ***** ********Section B*** letters_one is : dog numbers_one is : 42 ******Section C** 10. letters_two is : ewe 11. numbers_two is : 2021 12. ********Section D***** 13. The quotient is: 48, and the remainder is: 5 14. *********Section E***** 15. The result of concatenating letters_two with letters_one is: ewedog 4. 5. 6. 7. 8. 9. *****

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

=+ What topics are contained in the contracts?

Answered: 1 week ago