Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have made a program, which calculates the area of Circle, Square and Triangle. The code is working if i press "run" command in Pychram. But when i upload it to git i get an email, that shows, the code is completely incorrect.

The code:
"""Ask user a shape and a radius or a side length and calculate the shape area."""

from math import pi, sqrt
Kujund = input("Please insert geometric shape:")
if Kujund == "Circle":
geomtry_ask_radius_circle = input("Please insert radius in cm:")
r_float = float(geomtry_ask_radius_circle)
Pindala1 = pi * r_float ** 2
Vastus = round(Pindala1, 2)
print(Vastus, "cm^2")

elif Kujund == "Square":
geomtry_ask_side_length_square = input("Please insert side length in cm:")
k_int = int(geomtry_ask_side_length_square)
Pindala2 = k_int**2
print(Pindala2, "cm^2")
elif Kujund == "Triangle":
geomtry_ask_side_length_triangle = input("Please insert side length in cm:")
t_float = float(geomtry_ask_side_length_triangle)
Pindala3 = sqrt(3) / 4
Vastus1 = round(Pindala3, 2)
print(Vastus1, "cm^2")
else:
print("Shape is not supported.")

The email i get:
Style conventions checker results:

PEP8 stylecheck:
geometry.py:6:4: E111 indentation is not a multiple of four
geometry.py:7:4: E111 indentation is not a multiple of four
geometry.py:8:4: E111 indentation is not a multiple of four
geometry.py:9:4: E111 indentation is not a multiple of four
geometry.py:10:4: E111 indentation is not a multiple of four
geometry.py:13:4: E111 indentation is not a multiple of four
geometry.py:14:4: E111 indentation is not a multiple of four
geometry.py:15:4: E111 indentation is not a multiple of four
geometry.py:16:4: E111 indentation is not a multiple of four
geometry.py:18:4: E111 indentation is not a multiple of four
geometry.py:19:4: E111 indentation is not a multiple of four
geometry.py:20:4: E111 indentation is not a multiple of four
geometry.py:21:4: E111 indentation is not a multiple of four
geometry.py:22:4: E111 indentation is not a multiple of four
geometry.py:24:4: E111 indentation is not a multiple of four
15 E111 indentation is not a multiple of four

PEP257 stylecheck:
Code conforms to PEP257 (docstring conventions) guidelines! Great work!

Style percentage: 0%


Test: test_ex01_geometry.py

test_geometry_ask_shape[subprocess]: passed (42.78 ms)

test_geomtry_ask_radius_circle[subprocess]: FAILED (21.13 ms)

test_geomtry_ask_side_length_square[subprocess]: FAILED (23.63 ms)

test_geomtry_ask_side_length_triangle[subprocess]: FAILED (21.23 ms)

test_geometry_triangle_example_output[subprocess]: FAILED (21.74 ms)

test_geometry_circle_example_output[subprocess]: FAILED (51.09 ms)

test_geometry_square_random_output[subprocess]: FAILED (27.18 ms)

test_geometry_triangle_random_output[subprocess]: FAILED (21.5 ms)

test_geometry_else_output[subprocess]: passed (41.63 ms)


Total number of tests: 9
Passed tests: 2
Failed tests: 7

What I have tried:

I have changed the name of variables, wrote big and small letters, but still incorrect.
Posted
Updated 8-Sep-19 10:50am

1 solution

Quote:
Code is ready and working, but GIT shows incorrect

as far as I can see, your usage of 3 spaces as indentation is perfectly legal, but Git want 4 spaces.
"indentation is not a multiple of four"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900