# Loop code not working

**URL:** <https://forum.freecodecamp.org/t/loop-code-not-working/445485>\
**Category:** Curriculum Help\
**Tags:** python\
**Created:** [February 10, 2021, 10:47am UTC](https://forum.freecodecamp.org/t/loop-code-not-working/445485 "2021-02-10T10:47:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajesh\_1807](https://avatars.discourse-cdn.com/v4/letter/r/eb8c5e/32.png) [@rajesh\_1807](https://forum.freecodecamp.org/u/rajesh_1807)\
**Post date:** [February 10, 2021, 10:47am UTC](https://forum.freecodecamp.org/t/loop-code-not-working/445485/1 "2021-02-10T10:47:29Z")

</div>

```python
cf1=[-200,50,60,70,100,50]
f=1.06
pv=0
for i in range(6):
    pv += cf1[i] / f**[i+1]
    print(pv)

```

GIVES ME A WIERD ERROR:

```plaintext
TypeError Traceback (most recent call last)
<ipython-input-80-c3095863493f> in <module>
      1 pv=0
      2 for i in range(6):
----> 3 pv += cf1[i] / f1**[i+1]
      4 print(pv)

TypeError: unsupported operand type(s) for ** or pow(): 'float' and 'list'

```

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [February 10, 2021, 10:48am UTC](https://forum.freecodecamp.org/t/loop-code-not-working/445485/2 "2021-02-10T10:48:59Z")

</div>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.

 ![Pre-formatted-text](https://global.discourse-cdn.com/freecodecamp/original/3X/1/b/1b18854f1059217f29370444396145cc3a0cd8ae.gif)

See [this post](http://www.freecodecamp.com/forum/t/forum-code-formatting/25574) to find the backtick on your keyboard.  
**Note:** Backticks (`) are not single quotes (’).

---

<div class="post-metadata">

**Author:** ![bmanasie](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/bmanasie/32/134249_2.png) [@bmanasie](https://forum.freecodecamp.org/u/bmanasie)\
**Post date:** [February 10, 2021, 11:12am UTC](https://forum.freecodecamp.org/t/loop-code-not-working/445485/3 "2021-02-10T11:12:38Z")

</div>

Using square brackets [i+1] is treated as a list. Use () instead.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [August 11, 2021, 11:13pm UTC](https://forum.freecodecamp.org/t/loop-code-not-working/445485/4 "2021-08-11T23:13:37Z")

</div>

Closed on August 11, 2021, 11:13pm UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
