Skip to content

comments were added for better understanding. #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions python3code/chapter02/forelse.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
'''

from math import sqrt
"""
math is module/ library under python which can perform simple math operations.
"""

for n in range(99, 1, -1):
root = sqrt(n)
if root == int(root):
for n in range(99, 1, -1): # we are iterating the for loop starting from 99 with a diffrence of 1 and ends at 10 (including).
root = sqrt(n) # this will calculate the square root of n
if root == int(root):# we are checking data type
print(n)
break
break # if condition not satisfy it will move out of loop

else:
print("Nothing.")
print("Nothing.") # when above execution condition fails.