Skip to content
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.