używam edytora vim jako IDE Pythona, poniżej znajduje się prosty program python obliczyć pierwiastek kwadratowy z liczby: - oczekiwane dwie puste linie pep8 ostrzegawczy w Pythonie
import cmath
def sqrt():
try:
num = int(input("Enter the number : "))
if num >= 0:
main(num)
else:
complex(num)
except:
print("OOPS..!!Something went wrong, try again")
sqrt()
return
def main(num):
squareRoot = num**(1/2)
print("The square Root of ", num, " is ", squareRoot)
return
def complex(num):
ans = cmath.sqrt(num)
print("The Square root if ", num, " is ", ans)
return
sqrt()
i ostrzeżenia są: -
1-square-root.py|2 col 1 C| E302 expected 2 blank lines, found 0 [pep8]
1-square-root.py|15 col 1 C| E302 expected 2 blank lines, found 1 [pep8]
1-square-root.py|21 col 1 C| E302 expected 2 blank lines, found 0 [pep8]
Czy możesz powiedzieć, dlaczego te ostrzeżenia nadchodzą?
https://www.python.org/dev/peps/pep-0008/#blank-lines – Jasper