Starting Out with Python, 3e Ch 8

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

This string method returns true if a string contains only numeric digits and is at least one character in length. a. the digit method b. the isdigit method c. the numeric method d. the isnumber method

the isdigit method

This string method returns a copy of the string with all leading whitespace characters removed. a. lstrip b. rstrip c. remove d. strip_leading

lstrip

This string method returns a copy of the string with all leading and trailing whitespace characters removed. a. clean b. strip c. remove_whitespace d. rstrip

strip

This string method returns true if a string contains only alphabetic characters and is at least one character in length. a. the isalpha method b. the alpha method c. the alphabetic method d. the isletters method

the isalpha method

You can use the for loop to iterate over the individual characters in a string. T or F

True

This function returns the length of a string. a. length b. size c. len d. lengthof

len

This string method returns the lowest index in the string where a specified substring is found. a. first index of b. locate c. find d. index of

find

This operator determines whether one string is contained inside another string. a. contains b. is in c. == d. in

in

The isupper method converts a string to all uppercase characters. T or F

False

When you call a string's split method, the method divides the string into two substrings. T or F

False

This is the first index in a string. a. - 1 b. 1 c. 0 d. The size of the string minus one

0

This will happen if you try to use an index that is out of range for a string. a. A ValueError exception will occur. b. An IndexError exception will occur. c. The string will be erased and the program will continue to run. d. Nothing-the invalid index will be ignored.

An IndexError exception will occur.

This is the last index in a string. a. 1 b. 99 c. 0 d. The size of the string minus one

The size of the string minus one

Once a string is created, it cannot be changed. T or F

True

The repetition operator ( *) works with strings as well as with lists. T or F

True


Set pelajaran terkait

Allergic Rhinitis, Cough and Cold

View Set

Chapter 1- Systems Approach to a Foodservice Organization

View Set

Corporate Compliance: A Proactive Stance (2019)

View Set

Building Stronger Families & Communities

View Set

Solving and Preventing Incidents and Problems - Chapter 6

View Set

Chapter 66: Management of Patients With Neurologic Dysfunction

View Set

session 6 - financial management

View Set