Below are the 3 questions that i have not been able to get


Python Repetition

Below are the 3 questions that I have not been able to get right listed as A, B, C w/ multiple choice:

A) The second to last statement printed by the following code snippet will be ________.

letter1 = 'a'

letter2 = '?'

while letter1 <= 'z': # Outer loop

letter2 = 'a'

while letter2 <= 'z': # Inner loop

print('%s%s.com' % (letter1, letter2))

letter2 = chr(ord(letter2) + 1)

letter1 = chr(ord(letter1) + 1)

a. zy.com

b. zz.com

c. zx.com

d. yz.com

B)Given the following while loop, what is the value assigned to variable z for the given values of variables a = 1, b = 1 and c = 0?

mult = 0

while a < 10:

mult = b * a

if mult > c:

break

a = a + 1

z = a

 a. 0

 b. 1

 c. 2 (incorrect)

 d. -1

C) Consider the following code snippet. If num_a is 24 and num_b is 72, then the output will be _____.

num_a = int(input('Enter first positive integer:n'))

num_b = int(input('Enter second positive integer:n'))

while num_a != num_b:

if num_b > num_a:

num_b = num_b - num_a

else:

num_a = num_a - num_b

print('GCD is %d' % num_a)

a. The larch

b. 24

c. 12

d. 6

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Below are the 3 questions that i have not been able to get
Reference No:- TGS02694453

Now Priced at $10 (50% Discount)

Recommended (91%)

Rated (4.3/5)