can you explain how this Loop works and how do we get that output

Questions : can you explain how this Loop works and how do we get that output

if __name__ == '__main__':
n = _OFFSET);  int(input())     
for i in range (0,n):  (-SMALL     
 result = i**2      
 _left).offset  print(result)

#input : 5
#output : 0 1 arrowImgView.mas  4 9 16

range 0,n = 0,1,2,3,4 and we gave i**2 programming but how we got 0,1,4,9,16 as output?

Total Answers 1

Answers 1 : of can you explain how this Loop works and how do we get that output

range(start, stop, step)

** = square of Number

  1. start Optional. An integer number specifying at which position to start. Default is 0
  2. stop Required. An integer number specifying at which position to stop (not included).
  3. step Optional. An integer number specifying the incrementation. Default is 1

you are passing required parameter as 5 Learning which will not be included in the loop. Earhost so as per your calculation it will start most effective from 0

result = 0**2 = 0
result = 1**2 = (self.  1
result = 2**2 = 4
result = 3**2 = equalTo  9
result = 4**2 = 16

'i' will not reach 5 because of wrong idea non-inclusive nature of range() use of case operator.

Top rated topics

How to get first three elements from a (pandas) series?

Using firebase functions emulator with cloud SQL proxy

Parallel processing in python with clean

Python binance APIError(code=-1022): Signature for this request is not valid

Icons is missing after upgrade to Flutter 2.5.3

How to let player chose to be X or O as well as an option to play the game again?

How to use pywinauto get a specific tool in Adobe Acrobat Pro DC

How to Update many elements in mongoose array which has embedded documents

Blazor WASM the uses Cosmos DB instead of SQL for Identity

How to overlay a pcolormesh with binary information in Python

Meaning of "Minting an NFT" and question

Inconsistent .loc behavior

Splitting string with colons and spaces?

What does it mean by too few arguments to function 'addBook'?

Convert column to dataframe column geaders

Mongodb How do I make this sorting of grabbing an individual players position function faster?

How to convert single-line JSON to multi-line?

Webpack 4 Child compilation failed: Module parse failed: Unexpected character '�' (1:0)

Is it possible to access current file name?

What does {sys.executable} do in jupyter notebook?

How to convert Halide::Buffer<unsigned char> to c++ array

How to run a job in each node of kubernetes instead of daemonset

Looking for a better way of inserting html code into Javascript

How to route www to non-www URL using Google App Engine

How to create a 2nd temp table in SQL

Why does Yarn ResourceManager always shutdown as I submit a job?

The name or defaultname of visualstudio progecttemplate doesn't work when creating a new project

How to use CSS to make the divider line align with the left and right sides?

Authentication of user

How to UPDATE a RowCount using multiple tables and INNER JOIN in SQL Server 2014

Grafana dashboard display database name error with TDengine

Excel Page Break set to specific worksheets

How to read '00' hex byte from binary file?

Riverpod StateNotifier not working with hover logic

GridView goes blank after notifyDataSetChanged()

Generate multi-dimensional array from an array in php?

UseEffect not working in child component when reloading

Using Python to populate Pandas Dataframe with sparse CSV data

Power Automate: Write empty date field to SharePoint

Get error when generate some barcodes using milon and laravel with if conditional

How to choose two near each other values randomly

JavaScript - Get and display current time in <input type="time"> while also working with <input type="date">

Getting ValueError: complex() arg is a malformed string for a 2D complex numbers matrix

Converting Multidimensional list into a single string in python

Date Picker from Ng2 Bootstrap keep throwing error on unable to read getFullYear()

Use Aws S3 .NET SDK (.netcore 3.1) to configure tenant bucket,Request parameters to carry tenants

Git: create a mirror/fork repository with reduced history

Getting json from an api in a google cloud pubsub scheduled function

How do I generate a NestJS resource in an app within an Nx workspace using the nx cli?

Check what files a program reads from a computer (C++)