Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CREATE ALGORITHMS AND PROGRAMS USING BASIC PYTHON STRINGS FOR ALL QUESTIONS --- A1) Create an algorithm that accepts two inputs from the user. Assume that

CREATE ALGORITHMS AND PROGRAMS USING BASIC PYTHON STRINGS FOR ALL QUESTIONS

--- A1) Create an algorithm that accepts two inputs from the user. Assume that each input is at least five characters. Each of the following must be displayed: Display whether the first input is longer than the second. Display whether the second character from the right in the first input is the same as the second character from the left in the second input irrespective of case. Display the middle character in the first input. If there are two characters in the middle, display the one on the left. Display a string that consists of the first, third and fifth characters in the second string.

----- A2) an Algorithm A user may enter some text and the number of times (up to a maximum of 10) to repeat it. Display the text repeated that many times with a space in between words. For example, if the user types in Hey and 3, the display would be Hey Hey Hey. If the user provides no text or provides a number greater than 10, display only an error message.

PROGRAM 1. Write a program that accepts user input of their name in a last name-comma-first name format (e.g., Prasad, Jay) and displays it as first name, space, and last name (e.g., Jay Prasad). (Do NOT use the split operation; that will be discussed later.)

PROGRAM 2. Write a program to display in Fahrenheit a temperature provided in Celsius by the user. However, if the user enters something that cannot be used, display the message - Bad Input - instead. Note that temperature input as a decimal, e.g., 50.5, should be acceptable.

PROGRAM 3. Write a program that asks users for their last name, validates it (i.e., checks it against business rules), and then displays it as confirmation with only the first letter capitalized, e.g., Prasad. If the name is not valid per our business rules, the display should be Invalid Name instead. The rules for last names at our business are: Names must be no longer than 20 characters but must be at least two characters. Names may have an apostrophe (e.g., ORourke) and/or a hyphen (e.g., SmithBarnes) but no other punctuation, no spaces, and no numbers. For example, we do not allow Smith Jr. (has space and period) or Smith III (has space).

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

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions