0% found this document useful (0 votes)
5 views

Python Daily Questions 51 - 100

Uploaded by

doddi.ajith2003
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Python Daily Questions 51 - 100

Uploaded by

doddi.ajith2003
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

PYTHON

DailY QuesTiONs (51 -100)

sTeP bY sTeP clear cuT


exPlaNaTiON

Prepared By:

Mani Shankar

Python Developer
51)

def follower():

name = input()

city = input()

output = f"{name} lives in {city}"

print(output)

follower()

Explanation:-

1. Function Definition:

The follower function is defined without any parameters.

def follower():

2. Input Prompt:

Inside the function, it prompts the user to input their name and city using the input() function.

name = input()

city = input()

3. String Construction:

It constructs a string using an f-string, which includes the user's name and city.

output = f"{name} lives in {city}"

4. Output:

It prints out the constructed string.

print(output)

5. Function Call:

Finally, the function follower is called.


follower()

6. Execution:

When the function is called, it prompts the user to input their name and city, constructs a string
with this information, and then prints out the string.

Example Execution:

Mani

Hyderabad

Mani lives in Hyderabad

Here, the user inputs their name as "Mani" and their city as "Hyderabad", and the program outputs
"Mani lives in Hyderabad".

So, The Final output is → Mani lives in Hyderabad

52)
a = 'Hii Mani"

b = a[4:]

print(b)

Explanation:-

1. String Initialization:

a is initialized as the string 'Hii Mani'.

a = 'Hii Mani'

2. Slicing:

b is assigned the substring of a starting from index 4 until the end of the string.

b = a[4:]

Here, slicing a[4:] extracts the characters from index 4 (inclusive) to the end of the string.
3. Print Statement:

The value of b is printed.

print(b)

4. Output:

The output of the code will be 'Mani'.

This is because b contains the substring of a starting from the fifth character ('M') until the end of the
string, which is 'Mani'.

So The Final Answer is → Mani

53)
def name(a):

return a.title()

print(name("hii mani"))

Explanation:-

1. Function Definition:

The name function is defined with one parameter a.

def name(a):

2. String Manipulation:

Inside the function, the .title() method is applied to the input string a, which capitalizes the first
character of each word in the string.

return a.title()

3. Function Call:

The function is called with the string "hii mani" as an argument.

print(name("hii mani"))

4. Output:

The output of the code will be "Hii Mani".

This is because the function `name` capitalizes the first character of each word in the input string,
resulting in "Hii Mani".

So The Final Answer is → Hii Mani


54)

names = ("Rani" , "Mani" , "Dani" ,)

print(names[1])

Explanation:-

1. Tuple Initialization:

- names is initialized as a tuple containing three strings: "Rani", "Mani", and "Dani".

names = ("Rani", "Mani", "Dani")

2. Accessing Element at Index 1:

- You're accessing the element at index 1 of the tuple names, which is "Mani".

print(names[1])

3. Output:

- The output of the code will be 'Mani'.

This is because tuple indices start from 0, so names[1] returns the element at index 1 of the tuple
names, which is "Mani".

So, The Final Answer is → Mani

55)

def num(a):

return a a

print(num(4))

Explanation:-

1. Function Definition:

The num function is defined with one parameter a.

def num(a):
2. Exponentiation:

Inside the function, a is raised to the power of itself using the exponentiation operator **.

return a ** a

3. Function Call:

The function is called with the argument 4.

print(num(4))

4. Output:

- The output of the code will be 256.

This is because 4 ** 4 equals 256, so the function returns 256, which is then printed.

So, The Final Answer is → 256.

56)
def word(name):

a = name.split()

b = name.title()

for i in name :

return b

result = input()

print(word(result))

Explanation:-

Here I am taking my name ‘mani’ as input

1. Function Definition:

The word function is defined with one parameter name.

def word(name):

2. Splitting the Input String:

Inside the function, the input string `name` is split into a list of words using the split() method and
stored in the variable a.

a = name.split()
3. Converting to Title Case:

The input string name is converted to title case using the title() method and stored in the variable
b.

b = name.title()

4. Loop Over Characters:

The code enters a loop to iterate over each character in the input string name. However, this loop
seems unnecessary because it doesn't perform any meaningful operation and immediately returns
the title-cased string b on the first iteration.

for i in name:

5. Return Title-Cased String:

Within the loop, the title-cased string b is immediately returned. However, since return terminates
the function, the loop only runs once.

return b

6. Function Call:

The user is prompted to input a string, and the input is stored in the variable result.

The word function is called with the input string as the argument.

result = input() #mani

print(word(result))

7. Output:

The function returns the title-cased version of the input string, and it is printed. i.e, Mani

So, The Final Answer is → Mani

57)

n=7

while n > 0:

print(n,end='')

n=n–1
Explanation:-

1. Variable Initialization:

n is initialized with a value of 7.

n=7

2. While Loop:

The while loop is executed as long as the condition n > 0 is true.

while n > 0:

3. Print Statement:

Inside the loop, the current value of n is printed without a newline (end='' ensures that the output
is on the same line).

print(n, end='')

4. Decrementing n:

After printing the value of n, it is decremented by 1.

n=n–1

5. Loop Termination:

The loop continues until n becomes 0. Once n becomes 0, the condition n > 0 becomes false, and
the loop terminates.

6. Output:

The output of the code will be the numbers from 7 to 1 printed in descending order on the same
line as 7654321

So The Final Answer is → 7654321


58)
a=6

b=1

for i in range(1,a+1):

b=b*i

print(b)

Explanation:-

1. Variable Initialization:

- a is initialized with a value of 6.

- b is initialized with a value of 1. This variable will hold the cumulative product of the numbers.

a=6

b=1

2. Factorial Calculation:

- The code enters a for loop that iterates from 1 to a (inclusive).

- During each iteration, the variable b is multiplied by the current value of i. This accumulates the
product of all numbers from 1 to a.

for i in range(1, a + 1):

b=b*i

3. Print Statement:

- The code prints the final value of b, which represents the factorial of a.

print(b)

4. Output:

- The output of the code will be the factorial of 6, which is 720.

So, The Final Answer is → 720


60)

a=1

while a<= 6 :

print(a,end='')

a = a-1

Explanation:-

1. Variable Initialization:

- a is initialized with a value of 1.

a=1

2. While Loop:

- The while loop continues as long as the condition a <= 6 is true.

while a <= 6:

3. Print Statement:

- Inside the loop, the current value of a is printed without a newline (end='' ensures that the output
is on the same line).

print(a, end='')

4. Decrementing a:

- After printing the value of a, it is decremented by 1.

a=a-1

5. Loop Termination:

- Since a is initially 1, and it's being decremented in each iteration, it will never be greater than 6,
resulting in an infinite loop.

6. Output:

- Since the loop is infinite, the code will keep printing as long as indefinitely

So, The Final Answer is → Infinite loop


61)

a=1

while a <= 6 :

print(a,end='')

a=a+1

Explanation:-

1. Variable Initialization:

- a is initialized with a value of 1. This variable will keep track of the current number to be printed.

a=1

2. While Loop:

- The while loop continues as long as the condition a <= 6 is true.

while a <= 6:

3. Print Statement:

- Inside the loop, the current value of a is printed without a newline (end='' ensures that the output
is on the same line).

print(a, end='')

4. Incrementing a:

- After printing the value of a, it is incremented by 1.

a=a+1

5. Loop Termination:

- The loop continues until a becomes greater than 6. Once a exceeds 6, the condition a <= 6
becomes false, and the loop terminates.

6. Output:

- The output of the code will be the numbers from 1 to 6 printed consecutively on the same line.

So, The Final Answer is → 123456


62)
def a(c,d):

return sorted(c) == sorted(d)

print(a('post','stop'))

Explanation:-

1. Function Definition:-

- The a function takes two parameters: c and d, which are strings to be checked for an anagram
relationship.

def a(c, d):

2. Sorting Strings:

- The function sorts the characters of both strings c and d using the sorted() function.

sorted_c = sorted(c)

sorted_d = sorted(d)

3. Comparison:

- The function compares the sorted versions of strings c and d using the equality operator ==. If the
sorted versions are equal, it means that the strings contain the same characters and hence are
anagrams.

return sorted_c == sorted_d

4. Function Call:

- The a function is called with the arguments 'post' and 'stop'.

print(a('post', 'stop'))

5. Output:

- The output of the code will be True, indicating that the strings 'post' and 'stop' are anagrams of
each other.

So, The Final Answer is → True


63)
a=0

for i in range(8):

a=a+1

print(a)

Explanation:-

1. Variable Initialization:

- a is initialized with a value of 0.

a=0

2. For Loop:

- The for loop iterates over the range from 0 to 7 (exclusive).

for i in range(8):

3. Incrementing a:

- Inside the loop, the variable a is incremented by 1 in each iteration.

a=a+1

4. Loop Termination:

- The loop iterates through all the values in the range 0 to 7.

5. Output:

- After the loop finishes executing, the value of a is printed.

print(a)

6. Output

- The output of the code will be the final value of a after the loop has finished executing. Since a is
incremented by 1 in each of the 8 iterations of the loop, the final value of a will be 8.

So, The Final Answer is → 8


64)
def a():

b = ["Happy Mother's Day ]

for i in b:

print(i)

a()

Explanation:-

1. Function Definition:

- The a function is defined without any parameters.

def a():

2. List Initialization :

- Inside the function, a list b is initialized with a single string element containing the message
"Happy Mother's Day".

b = [ "Happy Mother's Day" ]

3. For Loop:

- The function iterates over the elements of the list b using a for loop.

for i in b:

4. Print Statement:

- Inside the loop, each element of the list (in this case, the message "Happy Mother's Day") is
printed.

print(i)

5. Function Call:

- The a function is called.

a()

6. Output:

- The output of the code will be the message "Happy Mother's Day".

So, The Final Answer is → Happy Mother's Day


65)

def conduct_election():

candidates = {

'A': 'YSRCP',

'B': 'TDP(Janasena + BJP)',

'C': 'NOTA'

print("Welcome to the election!")

print("Choose your vote for whom:")

for key, value in candidates.items():

print(f"{key}) {value}")

vote = input("Enter your choice (A, B, or C): ").upper()

if vote in candidates:

print(f"You have voted for {candidates[vote]}. Thank you for voting!")

else:

print("Invalid choice. Please choose from A, B, or C.")

conduct_election()

Explanation:-

1. Candidates Dictionary:

- The candidates dictionary contains the candidates as keys and their corresponding parties as
values.

candidates = {

'A': 'YSRCP',

'B': 'TDP(Janasena + BJP)',

'C': 'NOTA'

}
2. Welcome Message and Candidate Information:

- A welcome message and prompts the voter to choose their vote from the available options.

print("Welcome to the election!")

print("Choose your vote for whom:")

for key, value in candidates.items():

print(f"{key}) {value}")

3. User Input:

- Now, the user to enter their choice (either 'A', 'B', or 'C').

vote = input("Enter your choice (A, B, or C): ").upper()

- The input is converted to uppercase using the upper() method to ensure consistency.

4. Voting Validation:

- checks if the entered vote is valid by verifying if it exists as a key in the candidates dictionary.

if vote in candidates:

5. Voting Confirmation:

- If the vote is valid, the code prints a confirmation message indicating the candidate the voter has
chosen.

print(f"You have voted for {candidates[vote]}. Thank you for voting!")

- If the vote is invalid, a message is printed indicating that the choice is invalid.

else:

print("Invalid choice. Please choose from A, B, or C.")

6. Function Call:

- The conduct_election() function is called to initiate the election process.

conduct_election()

7. Output:
The output of the code will be based on the user's input and the voting process.

For Example :-

If you choose one of the options above (A, B, C), for example, if you choose A, then the output will
be:'You have voted for YSRCP. Thank you for voting.

Otherwise, if you choose a party that is not listed among the three options (A, B, C), the output will
be: Invalid choice. Please choose from A, B, or C.

66)
def num(a):

if a < 0:

return "invalid number"

elif a == 0:

return True

else:

b = int(a ** 0.5)

return b * b == a

print(num(36))

Explanation:-

1. Function Definition:

- The num function is defined with one parameter a, which represents the number to be checked.

def num(a):

2. Conditions:

- The function checks multiple conditions to determine the nature of the number:

- If a is less than 0, it returns the string "invalid number".

- If a is equal to 0, it returns True.

- Otherwise, it proceeds to check if a is a perfect square.


if a < 0:

return "invalid number"

elif a == 0:

return True

else:

3. Checking for Perfect Square:

- Inside the else block, the square root of a is computed using the expression int(a ** 0.5).

- The function checks if the square of the computed square root is equal to a. If it is, then a is a
perfect square; otherwise, it is not.

b = int(a ** 0.5)

return b * b == a

4. Function Call:

- The num function is called with the argument 36.

print(num(36))

5. Output:

- The output of the code will be True, indicating that 36 is a perfect square.

So, The Final Answer is → True

67)
a = [1,2,3,4,5]

b=a

b[2] = 26

print(a)

Explanation:-

Here, a and b refer to the same list object. Therefore, any changes made to b will also affect a
because they are essentially two names for the same list in memory.
Let's see step by step:

1. List Initialization:

- a is initialized with a list [1, 2, 3, 4, 5].

a = [1, 2, 3, 4, 5]

2. Reference Assignment:

- b is assigned to refer to the same list object as a. This means that both a and b point to the same
list in memory.

b=a

3. Modification of b:

- The element at index 2 of list b is modified to 26. Since a and b refer to the same list, this change
affects a as well.

b[2] = 26

4. Print Statement:

- The code prints the list a.

print(a)

5. Output:

- The output will be [1, 2, 26, 4, 5], because the third element of the list (a[2]) has been modified to
26 by changing b.

So, The Final Answer is → [1, 2, 26, 4, 5]

68)
a = ("madam","sir")

b = "madam anthe"

print(type(a))

print(type(b))
Explanation:-

1. Tuple Initialization:

- a is initialized as a tuple containing two strings "madam" and "sir".

a = ("madam", "sir")

2. String Initialization:

- b is initialized as a string "madam anthe".

b = "madam anthe"

3. Type Check:

- Here, the type of variables a and b using the type() function.

print(type(a))

print(type(b))

4. Output:

- The output will be:

<class 'tuple'>

<class 'str'>

This indicates that a is of type tuple and b is of type string.

So, The Final Output is :-

<class 'tuple'>

<class 'str'>

69)
def add(a):

b=0

for i in a:

b+= i

return float(b)

print(add((12,5,0,2,7)))
Explanation:-

1. Function Definition:

- The add function takes one parameter a, which is expected to be a tuple.

def add(a):

2. Variable Initialization:

- Inside the function, a variable b is initialized to 0. This variable will hold the cumulative sum of the
elements in the tuple.

b=0

3. Sum Calculation:

- The function iterates over each element i in the tuple a using a for loop.

- In each iteration, the value of b is incremented by the current element i, updating the cumulative
sum.

for i in a:

b += i

4. Return Statement:

- After the loop completes, the function returns the final value of b, which represents the sum of all
the elements in the tuple.

return float(b)

5. Function Call:

- The add function is called with the tuple (12, 5, 0, 2, 7) as an argument.

print(add((12, 5, 0, 2, 7)))

6. Output:

- The output of the code will be the sum of all the elements in the tuple (12, 5, 0, 2, 7), which is
26.0.

So, The Final Answer is → 26.0


70)
def multi(a):

b=1

for i in a:

b*= i

return b

print(multi((2,5,1,7)))

Example:-

1. Function Definition:

- The multi function takes one parameter a, which is expected to be a tuple.

def multi(a):

2. Variable Initialization:

- Inside the function, a variable b is initialized to 1. This variable will hold the cumulative product of
the elements in the tuple.

b=1

3. Product Calculation:

- The function iterates over each element i in the tuple a using a for loop.

- In each iteration, the value of b is multiplied by the current element i, updating the cumulative
product.

for i in a:

b *= i

4. Return Statement:

- After the loop completes, the function returns the final value of b, which represents the product
of all the elements in the tuple.

return b

5. Function Call:

- The multi function is called with the tuple (2, 5, 1, 7) as an argument.

print(multi((2, 5, 1, 7)))

6. Output:

- The output of the code will be the product of all the elements in the tuple (2, 5, 1, 7), which is 70.

So, The Final Answer is → 70


71)
a = "Chennai"

b = ""

for i in range(len(a)):

b = b + a[i] + " "

print(b)

Explanation:-

1. Variable Initialization:

- a is initialized with the string "Chennai".

- b is initialized with an empty string "".

a = "Chennai"

b = ""

2. Loop:

- The code iterates through each index of the string a using range(len(a)).

for i in range(len(a)):

3. Concatenation:

- In each iteration, the character at index i of string a is concatenated with the string b.

- Additionally, an empty string " " is concatenated after each character. This effectively adds an
empty space between each character in the final string.

b = b + a[i] + ""

4. Print Statement:

- The code prints the final string b.

print(b)

5. Output:

- The output of the code will be the string "C h e n n a i ", where each character of the original
string a is separated by a space.

So, The Final Answer is → C h e n n a i


72)
a = 10

b=0

for i in range(1,a+1):

b+=i

print(b)

Explanation:-

1. Variable Initialization:

- a is initialized with the value 10.

- b is initialized with the value 0.

a = 10

b=0

2. For Loop:

- The loop iterates over the range from 1 to a+1 (which is 11). This ensures that the loop runs for
values 1 through 10.

for i in range(1, a + 1):

3. Sum Calculation:

- In each iteration, the value of i is added to b.

- This accumulates the sum of all integers from 1 to 10 in b.

b += i

4. Print Statement:

- After the loop completes, the final value of b is printed.

print(b)

5. Output:

- The output of the code will be the sum of the numbers from 1 to 10.

So, The Final Answer is → 55


73)
a = 10

b=0

for i in range(1,a+1):

if i% 2!= 0:

b+=i

print(b)

Explanation:-

1. Variable Initialization:

- a is initialized with the value 10.

- b is initialized with the value 0.

a = 10

b=0

2. For Loop:

- The loop iterates over the range from 1 to a + 1 (which is 11). This ensures that the loop runs for
values 1 through 10.

for i in range(1, a + 1):

3. Odd Numbers Checking and doing Sum Calculation:

- Inside the loop, an if statement checks if i is odd by using the condition i % 2 != 0.

- If the condition is true (i.e., i is odd), the value of i is added to b.

if i % 2 != 0:

b += i

4. Print Statement:

- After the loop completes, the final value of b is printed.

print(b)

5. Output:
- The output of the code will be the sum of the odd numbers from 1 to 10.

So, The Final Answer is → 25

This is because the sum of the odd numbers is 1,3, 5, 7, and 9 is 25.

74)
a = 12345

a = str(a)

b=0

for i in a:

b +=1

print(b)

Explanation:-

1. Converting Integer to String:

- a is initialized with the integer 12345.

- a is then converted to a string using str(a) so that we can iterate over each digit.

a = 12345

a = str(a)

2. Variable Initialization:

- b is initialized with the value 0. This will be used to count the number of digits.

b=0

3. For Loop:

- The loop iterates over each character (which represents a digit) in the string a.

for i in a:

4. Count Digits:

- In each iteration, b is incremented by 1 to count each digit.

b += 1

5. Print Statement:
- After the loop completes, the final value of b (which is the number of digits) is printed.

print(b)

6. Output:

- The output of the code will be the number of digits in the integer 12345.

So, The Final Answer is → 5

This is because the integer 12345 has 5 digits.

75)
a = "DJ Tillu"

b = ""

for i in a:

b=i+b

print(b)

Explanation:-

1. Variable Initialization:

- a is initialized with the string "DJ Tillu".

- b is initialized as an empty string "".

a = "DJ Tillu"

b = ""

2. For Loop:

- The loop iterates over each character i in the string a.

for i in a:

3. Reverse Concatenation:

- In each iteration, the current character i is concatenated to the beginning of the string b.

- This effectively builds the string b in reverse order.


b=i+b

4. Print Statement:

- After the loop completes, the final value of b (which is the reversed string) is printed.

print(b)

5. Output:

- The output of the code will be the string "ulliT JD", which is the reverse of the original string "DJ
Tillu".

So, The Final Answer is → ulliT JD

76)
a = []

for i in range(10):

a.append(i)

print(a)

Explanation:-

1. List Initialization:

- An empty list a is initialized.

a = []

2. For Loop:

- The loop iterates over the range from 0 to 9 (exclusive).

for i in range(10):

3. Appending to List:

- In each iteration, the value of i is appended to the list a.

- This effectively adds numbers from 0 to 9 to the list.

a.append(i)

4. Print Statement:

- After the loop completes, the final contents of the list a is printed.

print(a)
5. Output:

- The output of the code will be the list [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].

So, The Final Answer is → [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

77)
a = ["Red","Green","White","Orange"]

for i in a:

print(i)

if i == "Green":

break

Explanation:-

1. List Initialization:

- a is initialized with the list ["Red", "Green", "White", "Orange"].

a = ["Red", "Green", "White", "Orange"]

2. For Loop:

- The loop iterates over each element in the list a.

for i in a:

3. Print Statement:

- The code prints the current element i in the list.

print(i)

4. Conditional Check:

- The code checks if the current element i is equal to the string "Green".

if i == "Green":

5. Break Statement:

- If the condition is true (i.e., i is "Green"), the loop breaks, stopping any further iteration.
break

6. Output:

- The output of the code will be the elements of the list up to and including "Green".

So, The Final Answer is →

Red

Green

78)
a = ["Red","Green","White","Orange"]

for i in a:

print(i)

if i == "Green":

continue

Explanation:-

1. List Initialization:

- a is initialized with the list ["Red", "Green", "White", "Orange"].

a = ["Red", "Green", "White", "Orange"]

2. For Loop:

- The loop iterates over each element in the list a.

for i in a:

3. Print Statement:

- The code prints the current element i in the list.

print(i)

4. Conditional Check:
- The code checks if the current element i is equal to the string "Green".

if i == "Green":

5. Continue Statement:

- If the condition is true (i.e., i is "Green"), the loop executes the continue statement.

- The continue statement skips the remaining code in the loop for the current iteration and
proceeds to the next iteration.

continue

6. Behavior:

- In this specific code, since there are no statements after the continue within the loop, it effectively
doesn't change the behavior of printing each element of the list.

7. Output:

- The output of the code will be each element of the list printed on a new line.

So, The Final Answer is →

Red

Green

White

Orange

79)
for i in range(1,3):

print(i)

else:

print("Mani")

Explanation:-

1. For Loop:

- The loop iterates over the range from 1 to 3 (excluding 3).

for i in range(1, 3):


2. Print Statement Inside the Loop:

- For each iteration, the current value of i is printed.

print(i)

3. Else Block:

- After the loop finishes iterating through the range, the else block is executed, printing "Mani".

else:

print("Mani")

4. Output:

- The loop runs from 1 to 2, printing each value of i.

- After the loop completes, the else block executes, printing "Mani".

So, The Final Answer is →

Mani

80)
a = "Python"

b = len(a)

c=0

for i in range(1,b + 1):

c=c*i

print(c)

Explanation:-

1. Variable Initialization:

- a is assigned the string "Python".

- b is assigned the length of the string a, which is 6 because the string "Python" has 6 characters.

a = "Python"

b = len(a) #b=6
2. Initial Value of c:

- c is initialized to 0.

c=0

3. For Loop:

- The loop iterates from 1 to b + 1 (which is 7), so it iterates through the values 1, 2, 3, 4, 5, and 6.

for i in range(1, b + 1): # i takes values from 1 to 6

4. Multiplication in the Loop:

- In each iteration of the loop, the value of c is multiplied by i and updated.

c=c*i

Here is the Detailed Iteration Analysis:

- Initial State:

- c is 0.

- First Iteration (i = 1):

- c = 0 * 1 → c remains 0.

- Second Iteration (i = 2):

- c = 0 * 2 → c remains 0.

- Third Iteration (i = 3):

- c = 0 * 3 → c remains 0.

- Fourth Iteration (i = 4):

- c = 0 * 4 → c remains 0.

- Fifth Iteration (i = 5):

- c = 0 * 5 → c remains 0.

- Sixth Iteration (i = 6):

- c = 0 * 6 → c remains 0.
Final Print Statement is , After the loop completes, the value of c is printed, which is 0.

print(c) # Output: 0

Explanation of the Result:

- Since c was initialized to 0, any multiplication with 0 results in 0. Therefore, c remains 0 throughout
all iterations of the loop.

So, The Final Answer is → 0.

81)
a = "Python"

b = len(a)

c=1

for i in range(1, b + 1):

c=c*i

print(c)

Explanation:-

1.Variable Initialization:

a is initialized with the string "Python".

b is initialized with the length of the string a, which is 6.

c is initialized with the value 1.

a = "Python"

b = len(a) # b is 6

c=1

2. For Loop:

The loop iterates over the range from 1 to b + 1 (which is 7), so it iterates from 1 to 6.

for i in range(1, b + 1):


3. Product Calculation:

In each iteration, c is multiplied by the current value of i and updated.

c=c*i

4. Print Statement:

After the loop completes, the final value of c is printed.

print(c)

5. Output:

The output will be the factorial of 6, which is 720

So, The Final Answer is → 720

82)
a = "coding with mani"

b = ""

for i in a:

if i != " ":

b=b+i

print(b)

Explanation:-

1. Variable Initialization:

- a is initialized with the string "coding with mani".

- b is initialized as an empty string "".

a = "coding with mani"

b = ""

2. For Loop:

- The loop iterates over each character i in the string a.

for i in a:
3. Conditional Check:

- Inside the loop, there is an if statement that checks if the character i is not a space (" ").

if i != " ":

4. String Concatenation:

- If the character is not a space, it is concatenated to the string b.

b=b+i

5. Print Statement:

- After the loop completes, the final value of b (which is the string a without spaces) is printed.

print(b)

6. Output:

- The output will be the string "codingwithmani" since all spaces have been removed from "coding
with mani".

So, The Final Answer is → codingwithmani

83)
a = "coding"

b = len(a)

for i in range(b-2):

print(a[i])

Explanation:-

1. Variable Initialization:

- a is initialized with the string "coding".

- b is initialized with the length of the string a, which is 6.

a = "coding"

b = len(a) # b is 6
2. For Loop:

- The loop iterates over the range from 0 to b-2 (which is 4), so it iterates from 0 to 3.

for i in range(b-2):

3. Print Statement:

- Inside the loop, the current character a[i] is printed.

print(a[i])

4. Explanation of the Iterations:

- When i is 0, a[0] is "c", and it prints "c".

- When i is 1, a[1] is "o", and it prints "o".

- When i is 2, a[2] is "d", and it prints "d".

- When i is 3, a[3] is "i", and it prints "i".

So, The Final Answer is →

84)
a = "mani"

b = ""

for i in range(len(a)):

b = b+(a[i] * i)

print(b)

Explanation:-

1. Variable Initialization:

- a is initialized with the string "mani".

- b is initialized as an empty string "".

a = "mani"

b = ""
2. For Loop:

- The loop iterates over the range of the length of the string a. This means it will iterate from 0 to
len(a) - 1 (i.e., from 0 to 3).

for i in range(len(a)):

3. String Concatenation:

- Inside the loop, for each index i, the character a[i] is repeated i times and concatenated to the
string b.

b = b + (a[i] * i)

4. Print Statement:

- After the loop completes, the final value of b is printed.

print(b)

5. Explanation of the Iterations :

- When i is 0, a[0] is "m" and "m" * 0 is "" (an empty string).

- When i is 1, a[1] is "a" and "a" * 1 is "a".

- When i is 2, a[2] is "n" and "n" * 2 is "nn".

- When i is 3, a[3] is "i" and "i" * 3 is "iii".

6. Building the Result :

- Concatenating these results gives the final string: "" + "a" + "nn" + "iii", which results in "anniii"`.

So, The Final Answer is → anniii

85)
a=3

b=1

c=0

while b<=a:

if b % 2 == 0:

c=c+b

b=b+1

print(c)
Explanation:-

1. Variable Initialization:

- a is initialized with the value 3.

- b is initialized with the value 1.

- c is initialized with the value 0.

a=3

b=1

c=0

2. While Loop:

- The loop runs as long as b is less than or equal to a.

while b <= a:

3. If Statement:

- Inside the loop, there is an if statement that checks if b is even (i.e., b % 2 == 0).

if b % 2 == 0:

4. Sum Calculation:

- If b is even, its value is added to c.

c=c+b

5. Increment b:

- b is incremented by 1 in each iteration of the loop.

b=b+1

6. Print Statement:

- After the loop completes, the value of c is printed.

print(c)

Explanation of the Iterations:

- Iteration 1: b = 1 (not even), so c remains 0. Increment b to 2.


- Iteration 2: b = 2 (even), so c = c + 2 which means c = 0 + 2 = 2. Increment b to 3.

- Iteration 3: b = 3 (not even), so c remains 2. Increment b to 4.

Since b is now 4 and the condition b <= a (i.e., 4 <= 3) is false, the loop terminates.

Output:

The final value of c, which is 2, is printed.

print(c) # Output: 2

So, The Final Answer is → 2

86)
a=3
b=1

c=0

while b<=0:

if b % 2 == 0:

c=c+b

b=b+1

print(c)

Explanation:-

1. Variable Initialization:

- a is initialized with the value 3.

- b is initialized with the value 1.

- c is initialized with the value 0.

a=3

b=1

c=0

2. While Loop:

- The loop condition is b <= 0.

while b <= 0:

3. Loop Condition Analysis:

- The initial value of b is 1, and the loop condition checks if b is less than or equal to 0.
- Since 1 is not less than or equal to 0, the condition is false, and the loop body will not execute
even once.

4. Print Statement:

- After the loop (which does not execute), the value of c is printed.

print(c)

Output:

Since the while loop condition b <= 0 is false from the beginning, the loop does not execute at all,
and the initial value of c, which is 0, is printed.

So, The Final Answer is → 0

87)
a = "Coding"

b = "C"

c=1

for i in a:

if i == b:

c=c+1

print(c)

Explanation:-

1. Variable Initialization:

- a is initialized with the string "Coding".

- b is initialized with the string "C".

- c is initialized with the integer 1.

a = "Coding"

b = "C"

c=1
2. For Loop:

- The loop iterates over each character in the string a.

for i in a:

3. If Statement:

- Inside the loop, the code checks if the current character i is equal to b.

if i == b:

4. Increment c:

- If the condition i == b is true, it increments c by 1.

c=c+1

5. Print Statement:

- After the loop completes, the value of c is printed.

print(c)

Explanation of the Iterations:

- Iteration 1: i = 'C' (matches `b`), so `c` is incremented by 1 (from 1 to 2).

- Iteration 2: i = 'o' (does not match `b`), so c remains 2.

- Iteration 3: i = 'd' (does not match `b`), so c remains 2.

- Iteration 4: i = 'i' (does not match `b`), so c remains 2.

- Iteration 5: i = 'n' (does not match `b`), so c remains 2.

- Iteration 6: `i = 'g' (does not match `b`), so `c` remains 2.

Output:

The final value of `c`, which is 2, is printed.

print(c) # Output: 2

So, The Final Answer is → 2


88)
a = 10

b = 100

for i in range(1,a):

if (i % 2) == 0:

b=b-i

print(b)

Explanation:-

1. Initialization:

a = 10

b = 100

2. Loop through the range:

for i in range(1, a):

This loop will iterate over the values of i from 1 to a-1 (1 to 9).

3. Conditional check and modification of b:

if (i % 2) == 0:

b=b-i

For each value of i in the range, we check if i is even (i.e., i % 2 == 0). If it is, we subtract i from b.

Let's see the iterations:

- Iteration 1: i = 1 (not even, no change)

- Iteration 2: i = 2 (even, b = 100 - 2 = 98)

- Iteration 3: i = 3 (not even, no change)

- Iteration 4: i = 4 (even, b = 98 - 4 = 94)

- Iteration 5: i = 5 (not even, no change)

- Iteration 6: i = 6 (even, b = 94 - 6 = 88)

- Iteration 7: i = 7 (not even, no change)

- Iteration 8: i = 8 (even, b = 88 - 8 = 80)


- Iteration 9: i = 9 (not even, no change)

After the loop completes, b has been modified as follows:

- Starting from b = 100 - Subtracted 2, then 4, then 6, then 8

So, the final value of b is: [ 100 - (2 + 4 + 6 + 8) = 100 - 20 = 80 ]

So, The Final Answer is → 80

89)
a = 10

for i in range(1,6):

a=a*i

print(a)

Explanation:-

1. Variable Initialization:

- a is initialized with the value 10.

a = 10

2. For Loop:

- The loop iterates over the range from 1 to 5 inclusive (i.e., range(1, 6)).

for i in range(1, 6):

3. Multiplication Inside the Loop:

- Inside the loop, a is multiplied by the current value of i, and the result is stored back in a.

a=a*i

4. Print Statement:
- After the loop completes, the final value of a is printed.

print(a)

Explanation of the Iterations:

- Iteration 1: i = 1

- a = 10 * 1 = 10

- Iteration 2: i = 2

- a = 10 * 2 = 20

- Iteration 3: i = 3

- a = 20 * 3 = 60

- Iteration 4: i = 4

- a = 60 * 4 = 240

- Iteration 5: i = 5

- a = 240 * 5 = 1200

Output:

The final value of a, which is 1200, is printed.

So, The Final Answer is → 1200

90)
a = "mani I Loveyou"

b = ""

for i in a[7:]:

b=b+i

print(b)

Explanation:-

1. String Initialization:

- a is initialized with the value "I Loveyou".

a = "I Loveyou"
2. Empty String Initialization:

- b is initialized as an empty string.

b = ""

3. For Loop:

- The loop iterates over the substring of a starting from index 2 to the end of the string.

for i in a[3:]:

- a[2:] means "start from index 7 to the end of the string". The substring from index 2 is "Loveyou".

4. String Concatenation:

- In each iteration, the current character i is appended to b.

b=b+i

5. Print Statement:

- After the loop completes, the final value of b is printed.

print(b)

Iterations:

- First Iteration: i = 'L', b = "L"

- Second Iteration: i = 'o', b = "Lo"

-Third Iteration: i = 'v', b = "Lov"

- Fourth Iteration: i = 'e', b = "Love"

- Fifth Iteration: i = 'y', b = "Lovey"

- Sixth Iteration: i = 'o', b = "Loveyo"

- Seventh Iteration: i = 'u', b = "Loveyou"

Output:

The final value of b, which is "Loveyou", is printed.

print(b) # Output: Loveyou

So, The Final Answer is → Loveyou


91)

a = 10

for i in range(1,6):

a=a-1

print(a)

Explanation:-

1. Initialization:

- a is initialized with the value 10.

a = 10

2. For Loop:

- A for loop runs from 1 to 5 (inclusive), which means it iterates 5 times.

for i in range(1, 6):

- In each iteration of the loop, a is decremented by 1.

a=a-1

3. Print Statement:

- After the loop completes, the final value of a is printed.

print(a)

Step by Step Iterations:

Let's see how a changes in each iteration of the loop:

- Initial value: a = 10

- First iteration: a = 10 - 1 = 9

- Second iteration: a = 9 - 1 = 8

- Third iteration: a = 8 - 1 = 7

- Fourth iteration: a = 7 - 1 = 6

- Fifth iteration: a = 6 - 1 = 5
Output:

After the loop completes, a is 5.

So, The Final Answer is → 5

92)
a=8

for i in range(6):

a=a*i

print(a)

Explanation:-

1. Initialization:

- a is initialized with the value 8.

a=8

2. For Loop:

- A for loop runs from 0 to 5 (inclusive), which means it iterates 6 times.

for i in range(6):

- In each iteration of the loop, a is multiplied by the current value of i.

a=a*i

3. Print Statement:

- After the loop completes, the final value of a is printed.

print(a)

Step by Step Iterations:

Let's see how a changes in each iteration of the loop:


- Initial value: a = 8

- First iteration (i = 0): a = 8 * 0 = 0

- Second iteration (i = 1): a = 0 * 1 = 0

- Third iteration (i = 2): a = 0 * 2 = 0

- Fourth iteration (i = 3): a = 0 * 3 = 0

- Fifth iteration (i = 4): a = 0 * 4 = 0

- Sixth iteration (i = 5): a = 0 * 5 = 0

Explanation:

- In the first iteration, i is 0, so a becomes 8 * 0 = 0.

- Once a becomes 0, multiplying by any number in subsequent iterations will keep a as 0.

Output:

After the loop completes, a is 0. Therefore, the output will be : 0

So, The Final Answer is → 0

93)

a=1

for i in range(2,6):

for j in range(2,6):

if i % j != 0:

a=a+1

print(a)

Explanation:-

1. Initialization:

- a is initialized with the value 1.

a=1
2. Nested For Loop:

- The outer loop runs from 2 to 5 (inclusive), which means it iterates 4 times.

for i in range(2, 6):

- The inner loop also runs from 2 to 5 (inclusive), which means it also iterates 4 times.

for j in range(2, 6):

- Inside the inner loop, there is an if statement that checks if i is not divisible by j. If the condition is
true, a is incremented by 1.

if i % j != 0:

a=a+1

3. Print Statement:

- After both loops complete, the final value of a is printed.

Step by step Iterations and Calculations:

Let's see how a changes in each iteration of the loops:

Outer Loop (i):

- First Iteration (i = 2):

- Inner Loop (j):

- j = 2: 2 % 2 == 0 (False, a is not incremented)

- j = 3: 2 % 3 != 0 (True, a becomes 2)

- j = 4: 2 % 4 != 0 (True, a becomes 3)

- j = 5: 2 % 5 != 0 (True, a becomes 4)

- Second Iteration (i = 3):

- Inner Loop (j):

- j = 2: 3 % 2 != 0 (True, a becomes 5)

- j = 3: 3 % 3 == 0 (False, a is not incremented)

- j = 4: 3 % 4 != 0 (True, a becomes 6)

- j = 5: 3 % 5 != 0 (True, a becomes 7)
- Third Iteration (i = 4):

- Inner Loop (j):

- j = 2: 4 % 2 == 0 (False, a is not incremented)

- j = 3: 4 % 3 != 0 (True, a becomes 8)

- j = 4: 4 % 4 == 0 (False, a is not incremented)

- j = 5: 4 % 5 != 0 (True, a becomes 9)

- Fourth Iteration (i = 5):

- Inner Loop (j):

- j = 2: 5 % 2 != 0 (True, a becomes 10)

- j = 3: 5 % 3 != 0 (True, a becomes 11)

- j = 4: 5 % 4 != 0 (True, a becomes 12)

- j = 5: 5 % 5 == 0 (False, a is not incremented)

Summary:

- For i = 2: a increments 3 times.

- For i = 3: a increments 3 times.

- For i = 4: a increments 2 times.

- For i = 5: a increments 3 times.

Output:

After both loops complete, the final value of a is 12. Therefore, the output will be: 12

So, The Final Answer is → 12

94)

a=1

for i in range(2,6):

for j in range(2,6):

if i % j == 0:

a=a+1

print(a)
Explanation:-

1. Initialization:

- a is initialized with the value 1.

a=1

2. Nested For Loop:

- The outer loop runs from 2 to 5 (inclusive), iterating 4 times.

for i in range(2, 6):

- The inner loop also runs from 2 to 5 (inclusive), iterating 4 times.

for j in range(2, 6):

- Inside the inner loop, there is an if statement that checks if i is divisible by j. If the condition is
true, a is incremented by 1.

if i % j == 0:

a=a+1

3. Print Statement:

- After both loops complete, the final value of a is printed.

print(a)

Step by Step Iterations and Calculations:

Let's track the value of a during each iteration of the loops:

Outer Loop (i):

- First Iteration (i = 2):

- Inner Loop (j):

- j = 2: 2 % 2 == 0 (True, a becomes 2)

- j = 3: 2 % 3 == 0 (False, a is not incremented)

- j = 4: 2 % 4 == 0 (False, a is not incremented)

- j = 5: 2 % 5 == 0 (False, a is not incremented)

- Second Iteration (i = 3):

- Inner Loop (j):


- j = 2: 3 % 2 == 0 (False, a is not incremented)

- j = 3: 3 % 3 == 0 (True, a becomes 3)

- j = 4: 3 % 4 == 0 (False, a is not incremented)

- j = 5: 3 % 5 == 0 (False, a is not incremented)

- Third Iteration (i = 4):

- Inner Loop (j):

- j = 2: 4 % 2 == 0 (True, a becomes 4)

- j = 3: 4 % 3 == 0 (False, a is not incremented)

- j = 4: 4 % 4 == 0 (True, a becomes 5)

- j = 5: 4 % 5 == 0 (False, a is not incremented)

- Fourth Iteration (i = 5):

- Inner Loop (j):

- j = 2: 5 % 2 == 0 (False, a is not incremented)

- j = 3: 5 % 3 == 0 (False, a is not incremented)

- j = 4: 5 % 4 == 0 (False, a is not incremented)

- j = 5: 5 % 5 == 0 (True, a becomes 6)

Summary:

- For i = 2: a increments 1 time.

- For i = 3: a increments 1 time.

- For i = 4: a increments 2 times.

- For i = 5: a increments 1 time.

Output:

After both loops complete, the final value of a is 6. Therefore, the output will be: 6

So, The Final Answer → 6


95)
a=1

for i in range(6,8):

for i in range(6,7):

a = a + (i+j)

print(a)

Explanation:-

1. Initialization:

a=1

The variable a is initialized to 1.

2. Outer Loop:

for i in range(6, 8):

The outer loop iterates with i taking the values 6 and 7. So, it will run twice: first with i = 6 and then
with i = 7.

3. Inner Loop:

for i in range(6, 7):

The inner loop iterates with i taking the value 6. However, this redefines i within the scope of the
inner loop, effectively shadowing the i from the outer loop.

4. Calculation:

a = a + (i + j)

Here, the code tries to update the value of a using the expression (i + j). However, there is no
variable j defined anywhere in the code, leading to a NameError.

Error Encountered

- NameError: Since j is not defined, the code will throw a NameError at the line where the calculation
a = a + (i + j) is attempted. This means the code will not execute beyond this point and will result in
an error.

So, The Final Answer is → NameError.


96)
a=1

for i in range(6,8):

for j in range(6,7):

a = a + (i-j)

print(a)

Explanation:-

1. Initialization:

- a is initialized with the value 1.

a=1

2. Nested For Loop:

- The outer loop runs from 6 to 7 (inclusive), iterating 2 times (i will take the values 6 and 7).

for i in range(6, 8):

- The inner loop runs from 6 to 6 (inclusive), iterating 1 time (j will take the value 6).

for j in range(6, 7):

3. Update Statement:

- Inside the inner loop, a is updated by adding the difference (i - j).

a = a + (i - j)

4. Print Statement:

- After both loops complete, the final value of a is printed.

print(a)

Step by Step Iterations and Calculations:

Outer Loop (i):

- First Iteration (i = 6):

- Inner Loop (j):

- j = 6: Calculate i - j, which is 6 - 6 = 0. Update a:


a = a + (i - j)

a=1+0

a=1

- Second Iteration (i = 7):

- Inner Loop (j):

- j = 6: Calculate i - j, which is 7 - 6 = 1. Update a:

a = a + (i - j)

a=1+1

a=2

Summary:

- After the first iteration of the outer loop (i = 6), a remains 1.

- After the second iteration of the outer loop (i = 7), a becomes 2.

Output:

After both loops complete, the final value of a is 2. Therefore, the output will be: 2

So, The Final Answer is → 2

97)
a=1

for i in range(6,8):

for j in range(6,7):

a = a * (i-j)

print(a)

Explanation:-

1. Initialization:

- a is initialized with the value 1.

a=1
2. Nested For Loop:

- The outer loop runs from 6 to 7 (inclusive), iterating 2 times (i will take the values 6 and 7).

for i in range(6, 8):

- The inner loop runs from 6 to 6 (inclusive), iterating 1 time (j will take the value 6).

for j in range(6, 7):

3. Update Statement:

- Inside the inner loop, a is updated by multiplying it with the difference (i - j).

a = a * (i - j)

4. Print Statement:

- After both loops complete, the final value of a is printed.

print(a)

Step-by-Step Iterations and Calculations:

Outer Loop (i):

- First Iteration (i = 6):

- Inner Loop (j):

- j = 6: Calculate i - j, which is 6 - 6 = 0. Update a:

a = a * (i - j)

a=1*0

a=0

- Second Iteration (i = 7):

- Inner Loop (j):

- j = 6: Calculate i - j, which is 7 - 6 = 1. Update a:

a = a * (i - j)

a=0*1

a=0

Summary:
- After the first iteration of the outer loop (i = 6), a becomes 0.

- After the second iteration of the outer loop (i = 7), a remains 0.

Output:

After both loops complete, the final value of a is 0. Therefore, the output will be: 0

So, The Final Answer is → 0

98)

a = 10

b = 80

for i in range(1,a):

if (i %3) == 0:

b=b+i

print(b)

Explanation:-

1. Initialization:

- a is initialized with the value 10.

- b is initialized with the value 80.

a = 10

b = 80

2. For Loop:

- The loop runs from 1 to 9 (inclusive), iterating 9 times (i will take the values 1 to 9).

for i in range(1, a):

3. Conditional Check:

- Inside the loop, there is a check to see if i is divisible by 3 (i % 3 == 0).

if (i % 3) == 0:

4.Update Statement:

- If the condition is true, b is incremented by the value of i.


b=b+i

5. Print Statement:

- After the loop completes, the final value of b is printed.

print(b)

Step-by-Step Iterations and Calculations:

- First Iteration (i = 1): 1 % 3 != 0, so b remains 80.

- Second Iteration (i = 2): 2 % 3 != 0, so b remains 80.

- Third Iteration (i = 3): 3 % 3 == 0, so b is updated:

b=b+i

b = 80 + 3

b = 83

- Fourth Iteration (i = 4): 4 % 3 != 0, so b remains 83.

- Fifth Iteration (i = 5): 5 % 3 != 0, so b remains 83.

- Sixth Iteration (i = 6): 6 % 3 == 0, so `b` is updated:

b=b+i

b = 83 + 6

b = 89

- Seventh Iteration (i = 7): 7 % 3 != 0, so b remains 89.

- Eighth Iteration (i = 8): 8 % 3 != 0, so b remains 89.

- Ninth Iteration (`i = 9`): 9 % 3 == 0, so b is updated:

b=b+i

b = 89 + 9

b = 98

Summary:

- After all iterations, the final value of b is 98.

Output:
After the loop completes, the final value of b is 98. Therefore, the output will be: 98

So, The Final Answer is → 98

99)

a=1

b = 99

for i in range(1,a):

b=b+2

print(b)

Explanation:-

1. Initialization:

- a is initialized with the value 1.

- b is initialized with the value 99.

a=1

b = 99

2. For Loop:

- The loop is supposed to run from 1 to a-1 (i.e., up to 0), but since the range function in Python
does not include the end value, it effectively becomes range(1, 1), which means the loop doesn't run
at all.

for i in range(1, a):

b=b+2

3. Print Statement:

- After the loop (which doesn't run), the value of b is printed.

print(b)

Explanation:
Since the loop for i in range(1, a) doesn't run because a is 1 and range(1, 1) is an empty range, the
value of b remains unchanged at 99.

Output:

After the loop completes (which it doesn't start), the final value of b is still 99. Therefore, the output
will be: 99

So, The Final Answer is → 99.

100)

a=0

for i in range(10):

for j in range(10):

a += 1

print(a)

Explanation:-

1. Initialization:

- a is initialized with the value 0.

a=0

2. Nested For Loop:

- The outer loop runs from 0 to 9 (inclusive), iterating 10 times (i will take the values 0 to 9).

for i in range(10):

- The inner loop also runs from 0 to 9 (inclusive), iterating 10 times for each iteration of the outer
loop (j will take the values 0 to 9).

for j in range(10):

3. Update Statement:

- Inside the inner loop, a is incremented by 1 during each iteration.

a += 1

4. Print Statement:

- After both loops complete, the final value of a is printed.

print(a)
Step by step Iterations and Calculations:

- Outer Loop (i):

- First Iteration (i = 0):

- Inner Loop (j):

- j = 0: a = a + 1 → a = 1

- j = 1: a = a + 1 → a = 2

- j = 2: a = a + 1 → a = 3

- j = 3: a = a + 1 → a = 4

- j = 4: a = a + 1 → a = 5

- j = 5: a = a + 1 → a = 6

- j = 6: a = a + 1 → a = 7

- j = 7: a = a + 1 → a = 8

- j = 8: a = a + 1 → a = 9

- j = 9: a = a + 1 → a = 10

- Second Iteration (i = 1):

- Inner Loop (j):

- j = 0: a = a + 1 → a = 11

- j = 1: a = a + 1 → a = 12

- j = 2: a = a + 1 → a = 13

- j = 3: a = a + 1 → a = 14

- j = 4: a = a + 1 → a = 15

- j = 5: a = a + 1 → a = 16

- j = 6: a = a + 1 → a = 17

- j = 7: a = a + 1 → a = 18

- j = 8: a = a + 1 → a = 19

- j = 9: a = a + 1 → a = 20

- Continuing in this pattern, each iteration of the outer loop will add 10 to a.

- Total Iterations:

- The outer loop runs 10 times.


- Each iteration of the outer loop runs the inner loop 10 times.

- Thus, a is incremented 10 * 10 = 100 times.

Summary:

- After all iterations, the final value of a is 100.

Output:

After both loops complete, the final value of a is 100.

So, The Final Answer is → 100

eND (TO be cONTiNueD...)

You might also like