Saved Bookmarks
| 1. |
What is following code doing? What would it print for input as 3 ? n = int (input( "Enter an integer:" )) if n< 1:print ("invalid value")else:for i in range(1, n + 1):print (i*i) |
|
Answer» it is if_else STATEMENT, it is USED to check weather the given argument is - true Or FALSE, compair the given argument etc. Explanation:let n be 3so, 3<1.........condition trueit will GIVE the output "invalid value" if 3 is entered as inputelse it will print(1,3+1)=4 ......... iso the output will be 4*4 =16 |
|