lis = "12345"
num = "0"
while num in lis:
print(num,end=" ")
Answers
Answered by
13
There is a syntax
U r violating the while loop syntax
Please refer the picture attached
Hope it helps you...............
And don't forget to mark me as brainliest.
Attachments:
Answered by
0
It will print nothing as the output.
Explanation:
Missing code:
- "what is the output of the code snip" is missing in the above question.
Answer Explanation:
- The above code is in python language which prints nothing and terminates as a normal termination.
- It is because the syntax defined above is a for loop syntax, not a while loop syntax which can be written as "for num in lis". It takes a num object and prints the all number or character from the list and there is no need to initialize the num variable.
- But when it is written with the while loop then it prints nothing because it takes the num value and searches from the list if match found print otherwise not.
- But when the value of num variable will be changed by any of the matching list values, then this loop behaves like the infinite loop.
- It is because the num is recognized by the variable not an object and the while condition will give true always. It is because there is no operation that pulls the condition to be false.
Learn More:
- Python for loop Program : https://brainly.in/question/11962694
- Python while loop: https://brainly.in/question/9094741
Similar questions
Accountancy,
6 months ago
Math,
6 months ago
Hindi,
1 year ago
English,
1 year ago
Geography,
1 year ago