# NEED EXPLANATION FOR THE CODE

**URL:** <https://discuss.codechef.com/t/need-explanation-for-the-code/123430>\
**Category:** help\
**Tags:** help, learn\
**Created:** [May 5, 2025, 1:52pm UTC](https://discuss.codechef.com/t/need-explanation-for-the-code/123430 "2025-05-05T13:52:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![manoharsena](https://discuss.codechef.com/user_avatar/discuss.codechef.com/manoharsena/32/208155_2.png) [@manoharsena](https://discuss.codechef.com/u/manoharsena)\
**Post date:** [May 5, 2025, 1:52pm UTC](https://discuss.codechef.com/t/need-explanation-for-the-code/123430/1 "2025-05-05T13:52:33Z")

</div>

### Scenario based questions

```auto
while num != 0:
    num = int(input("Enter a number: "))
print("Done")

```

Explain the code given above.

---

<div class="post-metadata">

**Author:** ![its\_harsh\_here](https://discuss.codechef.com/user_avatar/discuss.codechef.com/its_harsh_here/32/317798_2.png) [@its\_harsh\_here](https://discuss.codechef.com/u/its_harsh_here)\
**Post date:** [June 4, 2025, 8:49pm UTC](https://discuss.codechef.com/t/need-explanation-for-the-code/123430/2 "2025-06-04T20:49:52Z")

</div>

Basically it is a conditional loop that would keep on running until the user inputs a number other than one after “Done” would be printed!

---

<div class="post-metadata">

**Author:** ![atikrangnekar](https://discuss.codechef.com/user_avatar/discuss.codechef.com/atikrangnekar/32/288054_2.png) [@atikrangnekar](https://discuss.codechef.com/u/atikrangnekar)\
**Post date:** [June 28, 2025, 1:24pm UTC](https://discuss.codechef.com/t/need-explanation-for-the-code/123430/3 "2025-06-28T13:24:57Z")

</div>

if number is not 0 the while loop will run
