Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python What will be the value assigned to the variable `letter` below? food = 'spam' letter = food[1] Select one: a. p b. s c.

Python

What will be the value assigned to the variable `letter` below?

food = 'spam'

letter = food[1]

Select one:

a. p

b. s

c. a

d. pam

Imagine that you have assigned a string to a variable:

name = 'monty'

What expression would allow you to print out only the last letter of the string assigned to the variable called `name`?

Select one:

a. print(name[-1])

b. print(name[:])

c. print(name[0])

d. print(name[last])

Can you write a string traversal with a while loop?

Select one:

a. Yes

b. No

What is the technical name of a segment of a string?

Select one:

a. a bit

b. a slice

c. a peice

d. a cut

Are python strings mutable?

Select one:

a. No!

b. Yes!

Can a list be nested within another list?

Select one:

a. Yes

b. No

In python, a list is

Select one:

a. a sequence of values of any type, not just characters

b. a sequence of numbers only

c. a sequence of characters only

d. a sequence of strings

Fill in the blank:

The values in a list are called ______ or sometimes _____.

Select one:

a. slices; parts

b. bits; peices

c. whatchacallits; thingamajigs

d. sublists; bits

e. elements; items

What will be the output of the following command?

a = [0, 5, 10]

b = [15, 20, 25]

c = a+b

print(c)

Select one:

a. [0, 5, 10, 15, 20, 25]

b. [15, 20, 25, 0, 5, 10]

c. [15, 25, 35]

d. this will give an error; you can't add lists!

Match the Python data structure with its associated definition.

An ordered sequence of zero or more values that are enclosed in square brakets, [ and ]. The different values in the object of this type are separated by commas.

Answer 1Choose...ListTupleDictionaryString

An ordered sequence of zero or more values that are enclosed in parentheses, ( and ). The different values in an object of this type are generally separated by commas, although this is not required.

Answer 2Choose...ListTupleDictionaryString

An unordered collection of key, value pairs that are enclosed in curly braces, { and }. A key is separated form its corresponding value by a colon : and the different key-value entries in the collection are separated by commas.

Answer 3Choose...ListTupleDictionaryString

A sequence of zero or more characters that are enclosed within either a pair of single quote characters, ', or a pair of double quote characters, ".

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions