Question: Consider the stringnew _ string = 'Berlin is the capital of Germany'. Which statement will return 'capital of Germany' as a substring? Group of answer

Consider the stringnew_string = 'Berlin is the capital of Germany'. Which statement will return 'capital of Germany' as a substring?
Group of answer choices
new_string[15:35]
new_string[14:31]
new_string[-18:]
new_string[-18:1]What is the value of new_title?
title = 'Python for Beginners'
tokens = title.split('')
if 'Chapter 1' not in tokens:
tokens.append('Chapter 1')
new_title =''.join(tokens)
Group of answer choices
['Python', 'for', 'Beginners']
['Python', 'for', 'Beginners', 'Chapter 1']
'Python for Beginners Chapter 1'
'Python for Beginners'Which of the following code blocks produces the output given below?
['odd', 'even', 'odd', 'even']
Group of answer choices
new_list =[3,4,5,6]
for i in new_list:
if i %2==0:
i = 'even'
else:
i == 'odd'
print(new_list)
new_list =[3,4,5,6]
for i in range(len(new_list)):
if i %2==0:
new_list[i]= 'even'
else:
new_list[i]= 'odd'
print(new_list[i])
new_list =[3,4,5,6]
for i in new_list:
if new_list[i]%2==0:
new_list[i]= 'even'
else:
new_list[i]= 'odd'
print(new_list)
new_list =[3,4,5,6]
for i in range(len(new_list)):
if new_list[i]%2==0:
new_list[i]= 'even'
else:
new_list[i]= 'odd'
print(new_list)What is output?
new_list =[223,645,500,10,22]
new_list.sort()
for i in new_list:
ind = new_list.index(i)
if ind >0:
new_list[ind-1]+= i
print(new_list)
Group of answer choices
[868,1145,510,32,22]
[32,245,723,1145,645]
[22,32,510,1145]
[10,22,223,500,645]What is output?
new_list =['python', 'development']
new_list.append('in progress')
print(new_list)
Group of answer choices
['python', 'development', 'in progress']
['python', 'development', ['in progress']]
['python','in progress']
['python', 'developmentin progress']Which of the following options can sort the list in descending order?
i.list_name.sort(reverse=True)
ii.sorted(list_name, reverse=True)
iii.sorted(list_name)[::-1]
iv.sorted(list_name)
Group of answer choices
i, ii, iv
i, ii, iii
i, ii
i, ii, iii, iv
Flag question: Question 8
Question 81 pts
Fornum_diff = Diff(5,25), complete the code to print the following output when num_diff is printed.
First Number: 5
Second Number: 25
Difference: -20
class Diff:
def __init__(self, num1, num2):
self.num1= num1
self.num2= num2
def __str__(self):
XXX
Group of answer choices
return('f{self.num1 self.num2}')
return(f'First Number: {self.num1} Second Number: {self.num2}',(self.num1- self.num2))
return(f'First Number: {self.num1} Second Number: {self.num2} Difference: {self.num1- self.num2}')
return(f'First Number: {self.num1}
Second Number: {self.num2}
Difference: {self.num1- self.num2}')
Flag question: Question 9
Question 91 pts
A(n)_________ acts as afactorythat creates instance objects.
Group of answer choices
instance object
instance attribute
class object
class attribute
Flag question: Question 10
Question 101 pts
Which of the following is a correct definition for an instance method, print_age(), that has two parameters, date_of_birth and date_today, passed to it?
Group of answer choices
def print_age(self):
def print_age(self, date_of_birth, date_today):
def print_age(date_of_birth, date_today):

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 Programming Questions!