Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

String: a sequence of zero or more characters, enclosed within single or double quotation marks. It is an ordered collection of values. General Form: stringName

image text in transcribed
String: a sequence of zero or more characters, enclosed within single or double quotation marks. It is an ordered collection of values. General Form: stringName [ - "string value"]: Examples: lastName = "gates" firstName - William empty -- blank - String operations: The common operators (, -=) may be used with strings as well as concatenation(+), and functions for string manipulation such as: len(). lower(), upper. and title. 1. The concatenation (+) operator causes strings to be concatenated (i.e. joined together). Assign to fullName the characters in firstnane joined to lastName. 2. Assign to editedName the string constructed from joining lastName, a comma(.). a space, and firstName. 3. The built-in function len(s), where s is a string variable, returns the number of characters in that string. Assign to an int variable named length the number of characters in lastnane by invoking len(s). 4. The lower). upper and title methods invoked by an object named s: a. s.lower() is a built-in method (function) that is called to return a new string in lowercase: If given a variable named choice FromInput whose value may have been entered as 'y' or 'y', or as 'n' or 'N', assign to choice the lowercase value for choiceFromInput. b. s.upper) is invoked to return the string s in uppercase letters: When given a variable named firstInitialInput whose value may have been obtained by input as a value of unknown case, assign to firstInitial the value returned in uppercase for firstInitial Input. C. s.title() is used to convert the first letter of each word in a string to uppercase and the trailing letters in each word to lowercase: From the example variable values defined under the "General Form" side heading above, assign to theNames the value returned from title whose argument is a string expression for the join of firstName, to a blank, and to lastName. Also, show the joined values assigned to theNames

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions