Python Daily Question - 124

Опубликовано: 16 Июль 2026
на канале: coding_with_mani
20
0

Python Daily Question - 124

Step-by-Step Explanation:

1. Initialization:

a = "Hii"
b = "mani"
c = 6

a is a string "Hii".
b is a string "mani".
c is initialized to 6.

2. Outer Loop:

for i in a:

This loop iterates over each character in the string a.
The characters of a are 'H', 'i', and 'i'.

3. Inner Loop:
for j in b:

This loop iterates over each character in the string b.
The characters of b are 'm', 'a', 'n', and 'i'.

4. Condition and Increment:
if i == j:
c = c + 2

This statement checks if the characters i from a and j from b are equal. If they are equal, c is incremented by 2.

Detailed Iteration:

First iteration (i = 'H'):
j = 'm': H == m is False, so c remains 6
j = 'a': H == a is False, so c remains 6
j = 'n': H == n is False, so c remains 6
j = 'i': H == i is False, so c remains 6

Second iteration (i = 'i'):
j = 'm': i == m is False, so c remains 6
j = 'a': i == a is False, so c remains 6
j = 'n': i == n is False, so c remains 6
j = 'i': i == i is True, so c = c + 2 → c = 6 + 2 = 8

Third iteration (i = 'i'):
j = 'm': i == m is False, so c remains 8
j = 'a': i == a is False, so c remains 8
j = 'n': i == n is False, so c remains 8
j = 'i': i == i is True, so c = c + 2 → c = 8 + 2 = 10

Final Value of c:

After all the iterations, the value of c is 10.

Final Output: 10

So, the Final Answer is 10.





































































#coding_with_mani #python #code #viral #youtubeshorts #shorts #short #youtube #code #india #code #viral #youtubeshorts #shorts #short #youtube #code #india
#pythonquestions #python #coding #youtube #pythonprogramming #code #programminglanguage #pythonprogramming
#shorts #python #code #viral #trending #youtubeshorts #sql #sqlserver #data #database #daily #dailyshorts #dailyquestions #dailyseries