From 1ce12e777acd3f40c0341dc83277ff0a2df5c651 Mon Sep 17 00:00:00 2001 From: vikash Date: Thu, 12 Nov 2020 00:39:34 +0530 Subject: [PATCH] comments were added for better understanding. --- python3code/chapter02/forelse.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/python3code/chapter02/forelse.py b/python3code/chapter02/forelse.py index daac13a..cc753b3 100644 --- a/python3code/chapter02/forelse.py +++ b/python3code/chapter02/forelse.py @@ -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.