# Plz someone help

**URL:** <https://discuss.python.org/t/plz-someone-help/19882>\
**Category:** Python Help\
**Created:** [October 11, 2022, 9:21am UTC](https://discuss.python.org/t/plz-someone-help/19882 "2022-10-11T09:21:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anurag.kumar](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@Anurag.kumar](https://discuss.python.org/u/Anurag.kumar)\
**Post date:** [October 11, 2022, 9:21am UTC](https://discuss.python.org/t/plz-someone-help/19882/1 "2022-10-11T09:21:24Z")

</div>

Having error with rectangle

```auto
print('''
1) square
2) rectangle
''')
b=float(input('enter: '))

if b==1:
   c=int(input('enter length of square'))
print('area of square is:',c*c,'perimeter of square is:',c+c+c+c)

if b==2:
   e=int(input('enter length of rectangle'))
   d=int(input('breadth of the rectangle '))
print('area of rectangle is:',e*d,'perimeter of rectangle is:',e+d+e+d)

if b!=1 and b!=2:
    print('invalid input')

```

---

<div class="post-metadata">

**Author:** ![abessman](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/abessman/32/8367_2.png) [@abessman](https://discuss.python.org/u/abessman)\
**Post date:** [October 11, 2022, 9:31am UTC](https://discuss.python.org/t/plz-someone-help/19882/2 "2022-10-11T09:31:03Z")

</div>

You have the wrong indentation level on some of your `print`s. Try this:

```python
print('''
1) square
2) rectangle
''')
b=float(input('enter: '))

if b==1:
   c=int(input('enter length of square'))
   print('area of square is:',c*c,'perimeter of square is:',c+c+c+c)

if b==2:
   e=int(input('enter length of rectangle'))
   d=int(input('breadth of the rectangle '))
   print('area of rectangle is:',e*d,'perimeter of rectangle is:',e+d+e+d)

if b!=1 and b!=2:
    print('invalid input')

```

Also, equality comparisons with floats are dangerous:

```python
>>> 0.1 + 0.2 == 0.3
False

```

Python is pretty good at doing what you would expect as long as you stick to integer values, but if you only need integers you should use ints instead of floats.

---

<div class="post-metadata">

**Author:** ![Anurag.kumar](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@Anurag.kumar](https://discuss.python.org/u/Anurag.kumar)\
**Post date:** [October 11, 2022, 9:33am UTC](https://discuss.python.org/t/plz-someone-help/19882/3 "2022-10-11T09:33:54Z")

</div>

Thank you sir

---

<div class="post-metadata">

**Author:** ![Anurag.kumar](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@Anurag.kumar](https://discuss.python.org/u/Anurag.kumar)\
**Post date:** [October 11, 2022, 9:34am UTC](https://discuss.python.org/t/plz-someone-help/19882/4 "2022-10-11T09:34:33Z")

</div>

How can I improve my indentation

---

<div class="post-metadata">

**Author:** ![abessman](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/abessman/32/8367_2.png) [@abessman](https://discuss.python.org/u/abessman)\
**Post date:** [October 11, 2022, 9:40am UTC](https://discuss.python.org/t/plz-someone-help/19882/5 "2022-10-11T09:40:49Z")

</div>

Here’s a recent discussion related to indentation that you may find helpful: [Indentation is important](https://discuss.python.org/t/indentation-is-important/19835)

In Python, code that belongs to a certain code block must share the same indentation level. In the code you included in your question, the print statements where you calculate area and circumference belong to the same code blocks as the code that collect the input variables, because those calculations depend on the input variables having already been defined.

To “improve your indentation”, you need to reach a conceptual understanding of what constitutes a code block. There is no shortcut here, you just need to practice.
