Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Before starting the first table, enter the following assignment statement into the interactive shell: > > > s = 'Hello World' Now that you have

Before starting the first table, enter the following assignment statement into the interactive shell:
>>> s = 'Hello World'
Now that you have the variable s, enter the following statements in the order they are presented. Many of the commands below are statements, not expressions. Hence, they are all followed by a print statement showing some output. In each case, write down what you see in the second column. If the command results in an error, simply write Error.
Statement Output
t1= tuple(s)
print(t1[:-1])
('H','e','l','l','o','','W','o','r','l')
s2= str(t1)
print(s2[:-1])
('H','e','l','l','o','','W','o','r','l','d'
s3= introcs.join(t1,',')
print(s3)
H-e-l-l-o--W-o-r-l-d
s4= introcs.join(t1,'')
print(s4)
error
t2= introcs.split(s)
print(t2)
("Hello", "World")
t3= introcs.split(s,'o')
print(t3)
('hell',' w','rld')
For the next table, we want you to reassign s, as follows:
>>> s ='str tups'
In the table below, the commands are all missing something, represented by a box. That something may be a literal or a variable. The second column displays the output. You need to fill in the box to give the desired output. If you are confused, go back and look at your answers in the first table.
Statements Output Missing
t1=(s)
print(t1)('s','t','r','','t','u','p','s')
tuple
s2= str(t1)
print(s2[:])'s','t','r','','t','u','p','s')
1
s3= introcs.join(t1,)
print(s3) s-t-r--t-u-p-s
s4= introcs.join(t1[:],'')
print(s4) tups
t2= introcs.(s)
print(t2)('str', 'tups')
t3= introcs.split(s,)
print(t3)('s','r ', 'ups')
['s']

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

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

explain how organizations can promote a positive safety climate.

Answered: 1 week ago