Python 3.7.9 (default, Aug 31 2020, 17:10:11) [MSC v.1916 64 bit (AMD64)]

Type "copyright", "credits" or "license" for more information.


IPython 7.18.1 -- An enhanced Interactive Python.


Restarting kernel...




In [1]: runfile('G:/UBCO/2020-2021/Python/20200930/for_loops.py', wdir='G:/UBCO/2020-2021/Python/20200930')

0

1

2

3

4

5

6

7

8

9

i**2 is in the loop:

0

0

1

1

2

4

3

9

4

16

5

25

6

36

7

49

8

64

9

81


i**2 is NOT in the loop:

0

1

2

3

4

5

6

7

8

9

81


Step by two:

0

2

4

6

8

x: [0. 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1. 1.1 1.2 1.3 1.4 1.5 1.6 1.7

1.8]

Results: [-0.0, 0.019198493654414298, 0.03919043057194907, 0.060070244503352854, 0.08194889882372983, 0.1049575951738314, 0.1292523806498573, 0.15501976986589477, 0.18248332254542876, 0.21191058440110952, 0.24361834453296421, 0.27797032560786367, 0.31535137406103264, 0.3560759822264981, 0.4001223909632299, 0.44643492253916167, 0.49135988237282596, 0.526464135360927, 0.5400000000000005]



In [2]: