Neural Sync Active
May 2026 - Python - Week 3 - Week 3 - Graded Assignment 3
Registry Synced
May 2026 - Python - Week 3 - Week 3 - Graded Assignment 3
3922 words
20 min read
Week 3 - Graded Assignment 3
Course: May 2026 - Python
Week 3 - Graded Assignment 3 WEEK 3 Due Jul 08, 2026 11:59 PM IST Overdue
Introduction
Week 3 - Graded Assignment 3Week 3
8th Jul
Week 3 - Graded Assignment 3
Week 3
Due Jul 08, 202611:59 PM ISTOverdue
Question 1 / 23
3 marks
1234567
plaintextHow many asterisks does the following code print? i = -3 while (i <= 13): print('**') print('*') i = i + 1
pythonHow many asterisks does the following code print? i = -3 while (i <= 13): print('**') print('*') i = i + 1
pythonHow many asterisks does the following code print? i = -3 while (i <= 13): print('**') print('*') i = i + 1
Answer is Correct Score: 3 / 3
Options:
- A. 51 ✅
- B. 25
- C. 39
- D. 48
Question 2 / 23
3 marks
1234567891011121314151617
plaintextConsider the following snippet of code. name = input() nick = '' # there is no space between the quotes space = ' ' # there is one space between the quotes first_char = True for char in name: if first_char == True: nick = nick + char first_char = False if char == space: first_char = True print(nick) What is the output for the following input? Albus Percival Brian Wulfric Dumbledore
pythonConsider the following snippet of code. name = input() nick = '' # there is no space between the quotes space = ' ' # there is one space between the quotes first_char = True for char in name: if first_char == True: nick = nick + char first_char = False if char == space: first_char = True print(nick) What is the output for the following input? Albus Percival Brian Wulfric Dumbledore
pythonConsider the following snippet of code. name = input() nick = '' # there is no space between the quotes space = ' ' # there is one space between the quotes first_char = True for char in name: if first_char == True: nick = nick + char first_char = False if char == space: first_char = True print(nick) What is the output for the following input? Albus Percival Brian Wulfric Dumbledore
Answer is Correct Score: 3 / 3
Options:
- A. 1Albus
- B. 1Dumbledore
- C. 1AP
- D. 1APBWD ✅
Question 3 / 23
3 marks
The first five terms of the Fibonacci sequence is given below.
F1=1F2=1F3=2F4=3F5=5
\displaystyle \begin{gathered}
F_1 = 1 \quad F_2 = 1 \quad F_3 = 2\
F_4 = 3 \quad F_5 = 5
\end{gathered}
F1=1F2=1F3=2F4=3F5=5
We wish to write a program that accepts a positive integer nnn as input and
prints FnF_nFn as the output. Select all correct implementations of this program.
(MSQ)
Answer is Correct Score: 3 / 3
Options:
- A. n = int(input()) F_prev = 1 F_curr = 1 count = 2 while count < n: temp = F_prev + F_curr F_prev = F_curr F_curr = temp count += 1 print(F_curr) ✅
- B. n = int(input()) if n <= 2: print(1) else: F_prev = 1 F_curr = 1 count = 2 while count < n: temp = F_prev + F_curr F_prev = F_curr F_curr = temp count += 1 print(F_curr) ✅
- C. n = int(input()) F_prev = 1 F_curr = 1 for i in range(n): temp = F_prev + F_curr F_prev = F_curr F_curr = temp print(F_curr)
- D. n = int(input()) F_prev = 1 F_curr = 1 for i in range(n - 2): temp = F_prev + F_curr F_prev = F_curr F_curr = temp print(F_curr) ✅
Question 4 / 23
3 marks
123456
plaintextIf the while loop of below code executes, when does it terminate? x = int(input("Enter any number: ")) while(x % 5 != 0 and x % 10 != 0): x = int(input("Enter any number: ")) print("outside loop, the value of x is ", x)
pythonIf the while loop of below code executes, when does it terminate? x = int(input("Enter any number: ")) while(x % 5 != 0 and x % 10 != 0): x = int(input("Enter any number: ")) print("outside loop, the value of x is ", x)
pythonIf the while loop of below code executes, when does it terminate? x = int(input("Enter any number: ")) while(x % 5 != 0 and x % 10 != 0): x = int(input("Enter any number: ")) print("outside loop, the value of x is ", x)
Answer is Partially Correct Score: 1.5 / 3
Options:
- A. 1Never terminates; it is an infinite loop.
- B. 1when we input a number which is multiple of 10.
- C. 1when we input a number which is multiple of 5. ✅
- D. 1when we input a number which is not a multiple of both 5 and 10.
Question 5 / 23
0 marks
In continuation to the last question you are also asked to capture the date and
time of transaction in the below format.
1
plaintextday-month-year hour:minute:second
Select the options that prints transaction records as in the sample output for
input given in the table below. Multiple options can be correct (MSQ).
Input
variable
VALUE
day
01
month
01
year
2021
hour
12
minute
30
second
00
Output
1
plaintext01-01-2021 12:30:00
pythonday-month-year hour:minute:second
python01-01-2021 12:30:00
pythonday-month-year hour:minute:second
python01-01-2021 12:30:00
Answer is Correct Score: 0 / 0
Options:
- A. 12print(day, month, year, sep = "-", end = " ") print(hour, minute, second, sep = ":") ✅
- B. 1print(f"{day}-{month}-{year} {hour}:{minute}:{second}") ✅
- C. 1print("{}-{}-{} {}:{}:{}".format(day, month, year, hour, minute, second)) ✅
- D. 1print("{0}-{1}-{2} {3}:{4}:{5}".format(day, month, year, hour, minute, second)) ✅
- E. 1print("{a}-{b}-{c} {d}:{e}:{f}".format(a = day, b = month, c = year, d = hour, e = minute, f = second)) ✅
- F. 1print("%s-%s-%s %s:%s:%s"%(day, month, year, hour, minute, second)) ✅
- G. None of the above.
Question 6 / 23
3 marks
You are an analyst in a Finance company. You are given a job to print the daily
transaction in below format.
1
plaintextcountry_code, currency_code, exchange_rate
Select the options that prints transaction records as in the sample output for
input given in the table below. Multiple options can be correct (MSQ).
Input
Variable
VALUE
country_code
IN
currency_code
RS
exchange_rate
73.2272
Output
1
plaintextIN, RS, 73.23
pythoncountry_code, currency_code, exchange_rate
pythonIN, RS, 73.23
pythoncountry_code, currency_code, exchange_rate
pythonIN, RS, 73.23
Answer is Correct Score: 3 / 3
Options:
- A. 1print(country_code, currency_code, exchange_rate, sep = ", ")
- B. 1print(f"{country_code}, {currency_code}, {exchange_rate:2.2f}") ✅
- C. 1print("{}, {}, {:2.2f}".format(country_code, currency_code, exchange_rate)) ✅
- D. 1print("{0}, {1}, {2:2.2f}".format(country_code, currency_code, exchange_rate)) ✅
- E. 1print("{a}, {b}, {c:2.2f}".format(a = country_code, b = currency_code, c = exchange_rate)) ✅
- F. 1print("%s, %s, %2.2f"%(country_code, currency_code, exchange_rate)) ✅
Question 7 / 23
3 marks
How many times the print statement get executed? It is a Numerical Type
Question (NAT).
for i in range(1231, -12420, -7):
print(i)
Your Answer:
(Not answered)Question 8 / 23
3 marks
How many times do the break statements get executed? It is a Numerical Type
Question (NAT).
for i in range(10):
for j in range(10):
break
break
Your Answer:
(Not answered)Question 9 / 23
3 marks
12345678910111213
plaintextIs it possible to get the below output without using any loop and without repeating the string Hello Python! in Python? Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python!
pythonIs it possible to get the below output without using any loop and without repeating the string Hello Python! in Python? Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python!
pythonIs it possible to get the below output without using any loop and without repeating the string Hello Python! in Python? Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python! Hello Python!
Answer is Correct Score: 3 / 3
Options:
- A. 1True ✅
- B. 1False
Question 10 / 23
3 marks
A programmer wants to print a decreasing sequence. How many times does the
print statement get executed? And why?12
plaintextfor i in range(10, 0, 1): print(i)
pythonfor i in range(10, 0, 1): print(i)
pythonfor i in range(10, 0, 1): print(i)
Answer is Correct Score: 3 / 3
Options:
- A. 1One time because i takes only the value 10 and thereafter it will be decremented
- B. 1One time because i takes only the value 9 and thereafter it will be decremented.
- C. 1print statement will not be executed due to invalid end points
- D. 1print statement will not be executed due to incompatible step size ✅
Question 11 / 23
0 marks
12345
plaintextSelect all the snippets that prints the sum of the first n odd numbers starting from 1 (including). Assume n is a positive integer and is already defined. Example n = 5, output: 1 + 3 + 5 + 7 + 9 = 25
pythonSelect all the snippets that prints the sum of the first n odd numbers starting from 1 (including). Assume n is a positive integer and is already defined. Example n = 5, output: 1 + 3 + 5 + 7 + 9 = 25
pythonSelect all the snippets that prints the sum of the first n odd numbers starting from 1 (including). Assume n is a positive integer and is already defined. Example n = 5, output: 1 + 3 + 5 + 7 + 9 = 25
Answer is Partially Correct Score: 0 / 0
Options:
- A. 123456result = 0 i = 0 while i<n: result+=2*i+1 i+=1 print(result) ✅
- B. 123456result = 0 i = 1 while i<n: result+=2*i+1 i+=1 print(result)
- C. 1234567result = 0 i = 1 while i<n: result+=2*i+1 i+=1 result+=1 print(result)
- D. 1234567result = 0 i = 0 while i<n: if i%2 != 0: result+=2*i+1 i+=1 print(result)
- E. 1234567result = 0 i = 0 while i<2*n+1: if i%2 != 0: result+=i i+=1 print(result) ✅
- F. 1234567result = 0 i = 0 while i<2*n+1: if i%2 != 0: result+=i i+=1 print(result)
- G. 1234567result = 0 i = 0 while i<2*n+1: if i%2 != 0: result+=i i+=1 print(result)
Question 12 / 23
3 marks
1234567891011
plaintextConsider the below code. n = int(input()) value = "" for i in range(n): value += input() * 2 + " " print(value) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) value = "" for i in range(n): value += input() * 2 + " " print(value) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) value = "" for i in range(n): value += input() * 2 + " " print(value) Select all the data processing pattern(s) found in the given code.
Answer is Correct Score: 3 / 3
Options:
- A. 1Aggregation ✅
- B. 1Filtering
- C. 1Mapping ✅
- D. 1None of the above
Question 13 / 23
3 marks
12345678910
plaintextConsider the below code. sentence = input() for word in sentence.split(): if 'a' in word: print(word * 2) break Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. sentence = input() for word in sentence.split(): if 'a' in word: print(word * 2) break Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. sentence = input() for word in sentence.split(): if 'a' in word: print(word * 2) break Select all the data processing pattern(s) found in the given code.
Answer is Wrong Score: 0 / 3
Options:
- A. 1Aggregation
- B. 1Filtering ❌ (your answer)
- C. 1Mapping ✅
- D. 1None of the above
Question 14 / 23
3 marks
123456789
plaintextConsider the below code. sentence = input() for word in sentence.split(): if 'a' in word: print(word*2) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. sentence = input() for word in sentence.split(): if 'a' in word: print(word*2) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. sentence = input() for word in sentence.split(): if 'a' in word: print(word*2) Select all the data processing pattern(s) found in the given code.
Answer is Correct Score: 3 / 3
Options:
- A. 1Aggregation
- B. 1Filtering ✅
- C. 1Mapping ✅
- D. 1None of the above
Question 15 / 23
3 marks
1234567891011
plaintextConsider the below code. sentence = input() for char in sentence: if char in 'aeiou': print(chr(ord(char) + 1), end='') else: print(chr(ord(char) - 1), end='') Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. sentence = input() for char in sentence: if char in 'aeiou': print(chr(ord(char) + 1), end='') else: print(chr(ord(char) - 1), end='') Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. sentence = input() for char in sentence: if char in 'aeiou': print(chr(ord(char) + 1), end='') else: print(chr(ord(char) - 1), end='') Select all the data processing pattern(s) found in the given code.
Answer is Correct Score: 3 / 3
Options:
- A. 1Aggregation
- B. 1Filtering
- C. 1Mapping ✅
- D. 1None of the above
Question 16 / 23
3 marks
123456789101112
plaintextConsider the below code. sentence = input() value = "" for char in sentence: if char in 'aeiou': value += chr(ord(char) + 1) print(value) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. sentence = input() value = "" for char in sentence: if char in 'aeiou': value += chr(ord(char) + 1) print(value) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. sentence = input() value = "" for char in sentence: if char in 'aeiou': value += chr(ord(char) + 1) print(value) Select all the data processing pattern(s) found in the given code.
Answer is Correct Score: 3 / 3
Options:
- A. 1Aggregation ✅
- B. 1Filtering ✅
- C. 1Mapping ✅
- D. 1None of the above
Question 17 / 23
3 marks
12345678
plaintextConsider the below code. n = int(input()) for i in range(n): print(int(input()) * 2) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) for i in range(n): print(int(input()) * 2) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) for i in range(n): print(int(input()) * 2) Select all the data processing pattern(s) found in the given code.
Answer is Correct Score: 3 / 3
Options:
- A. 1Aggregation
- B. 1Filtering
- C. 1Mapping ✅
- D. 1None of the above
Question 18 / 23
3 marks
123456789101112131415
plaintextConsider the below code. n = int(input()) value = None for i in range(n): num = int(input()) if value is None: value = num elif num < value: value = num print(value) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) value = None for i in range(n): num = int(input()) if value is None: value = num elif num < value: value = num print(value) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) value = None for i in range(n): num = int(input()) if value is None: value = num elif num < value: value = num print(value) Select all the data processing pattern(s) found in the given code.
Answer is Correct Score: 3 / 3
Options:
- A. 1Aggregation ✅
- B. 1Filtering
- C. 1Mapping
- D. 1None of the above
Question 19 / 23
3 marks
123456789101112131415
plaintextConsider the below code. n = int(input()) value = None for i in range(n): num = len(input()) if value is None: value = num elif num / 2 < value: value = num print(value) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) value = None for i in range(n): num = len(input()) if value is None: value = num elif num / 2 < value: value = num print(value) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) value = None for i in range(n): num = len(input()) if value is None: value = num elif num / 2 < value: value = num print(value) Select all the data processing pattern(s) found in the given code.
Answer is Correct Score: 3 / 3
Options:
- A. 1Aggregation ✅
- B. 1Filtering
- C. 1Mapping
- D. 1None of the above
Question 20 / 23
3 marks
1234567891011121314151617
plaintextConsider the below code. n = int(input()) values = {} for i in range(n): num = int(input()) l = len(str(num)) if l not in values: values[l] = set() values[l].add(num) print(values) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) values = {} for i in range(n): num = int(input()) l = len(str(num)) if l not in values: values[l] = set() values[l].add(num) print(values) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) values = {} for i in range(n): num = int(input()) l = len(str(num)) if l not in values: values[l] = set() values[l].add(num) print(values) Select all the data processing pattern(s) found in the given code.
Answer is Wrong Score: 0 / 3
Options:
- A. 1Aggregation ❌ (your answer)
- B. 1Filtering
- C. 1Mapping
- D. 1None of the above
Question 21 / 23
3 marks
12345678910
plaintextConsider the below code. n = int(input()) for i in range(n): a = input() b = input() print(b) print(a) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) for i in range(n): a = input() b = input() print(b) print(a) Select all the data processing pattern(s) found in the given code.
pythonConsider the below code. n = int(input()) for i in range(n): a = input() b = input() print(b) print(a) Select all the data processing pattern(s) found in the given code.
Answer is Correct Score: 3 / 3
Options:
- A. 1Aggregation
- B. 1Filtering
- C. 1Mapping
- D. 1None of the above ✅
Question 22 / 23
4 marks
12345678910111213141516171819
plaintextConsider the below Python code. num = int(input()) i = num result = 0 while True: i -= 4 if i > 10: continue if i < -10: break result += i print(result) Select all the possible outputs of the above code for any possible valid integer as input. Hint: To solve this question you might want to try out with different values of num or automate that with another loop with different values for num. What range of values do you use for this automation?
pythonConsider the below Python code. num = int(input()) i = num result = 0 while True: i -= 4 if i > 10: continue if i < -10: break result += i print(result) Select all the possible outputs of the above code for any possible valid integer as input. Hint: To solve this question you might want to try out with different values of num or automate that with another loop with different values for num. What range of values do you use for this automation?
pythonConsider the below Python code. num = int(input()) i = num result = 0 while True: i -= 4 if i > 10: continue if i < -10: break result += i print(result) Select all the possible outputs of the above code for any possible valid integer as input. Hint: To solve this question you might want to try out with different values of num or automate that with another loop with different values for num. What range of values do you use for this automation?
Answer is Wrong Score: 0 / 4
Options:
- A. 15 ✅
- B. 14 ❌ (your answer)
- C. 10 ✅
- D. 1-4 ✅
- E. 1-6 ❌ (your answer)
- F. 1-9 ✅
- G. 1-10 ✅
- H. 1-11 ❌ (your answer)
- I. 1-12 ✅
- J. 1-13
Question 23 / 23
4 marks
123456789101112131415161718192021
plaintextConsider the below Python code. num = int(input()) i = num result = 0 while True: i -= 5 if i > 15: continue if i < -15: break result -= i print(result) Select all the possible outputs of the above code for any possible valid integer as input. Hint: To solve this question you might want to try out with different values of num or automate that with another loop with different values for num. What range of values do you use for this automation?
pythonConsider the below Python code. num = int(input()) i = num result = 0 while True: i -= 5 if i > 15: continue if i < -15: break result -= i print(result) Select all the possible outputs of the above code for any possible valid integer as input. Hint: To solve this question you might want to try out with different values of num or automate that with another loop with different values for num. What range of values do you use for this automation?
pythonConsider the below Python code. num = int(input()) i = num result = 0 while True: i -= 5 if i > 15: continue if i < -15: break result -= i print(result) Select all the possible outputs of the above code for any possible valid integer as input. Hint: To solve this question you might want to try out with different values of num or automate that with another loop with different values for num. What range of values do you use for this automation?
Answer is Wrong Score: 0 / 4
Options:
- A. 1-9 ✅
- B. 1-7 ❌ (your answer)
- C. 1-3 ✅
- D. 1-2 ❌ (your answer)
- E. 11 ❌ (your answer)
- F. 13 ✅
- G. 14 ❌ (your answer)
- H. 15 ✅
- I. 18 ❌ (your answer)
- J. 19 ✅