Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!