Python

¡Supera tus tareas y exámenes ahora con Quizwiz!

Using comma separation, we can combine strings and numbers (int & float) in a single Python print() function without a TypeError.

True

name = "skye homsi" name_1 = name.title() name_2 = name_1.swapcase() print(name_2) What is the output from the above code?

"sKYE hOMSI"

Which code formats the string "Green" to "GREEN"?

.upper()

Which code will result in the ltr_cnt = 2 for counting the letter "c" found in the following test_string? test_string = 'Mexico City'

A. - B. ltr_cnt = test_string.count('c') C. ltr_cnt = test_string.count('C') **D. None of the above

In the for loop below, the variable "word" is an arbitrary variable name. Any valid variable name can be used since its value is assigned only within this loop. for letter in word: print(letter)

False

The code print("I am", 17, "years old") will output: I am17years old

False

The string method .swapcase() converts from string to integer.

False

Which is not a start to a string iteration loop, given the following string variable assignment? word = "health"

For letter in word

Which is a properly formatted Python print() function example?

print("Welcome the", 3, "New students!")

Given the code below and entering "Colette" for user_name input: python total_cost = 22.95 user_name = input("Enter your name: ") Choose the print statement that will output: Colette - the total is $ 22.95 for today's purchase

print(user_name, "- the total is $", total_cost, "for today's purchase")


Conjuntos de estudio relacionados

Module 7 Biotechnology Problem Sets

View Set

Neoplasia continued: Differentiation

View Set

Hallmarks and Signaling of Cancer Cells

View Set

Cellular Regulation Tes Wood: Lewis 16/28/31/43/55 & Concept 10

View Set

Chapter 5 - Secularization Theory

View Set

LIT 2000 Intro to Literature Final Exam Study Set

View Set

CP Biology Chapter 1 Test (Sapling Questions)

View Set