Use if __name__ == "__main__":
if __name__ == "__main__":
This:
if a > 0:
sgn_a = ""
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
else:
sgn_a = "-"
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
can be shortened to
if a > 0:
sgn_a = ""
else:
sgn_a = "-"
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
There also seems to be an extra indentation (4 spaces) at the start of every line. I'm guessing that it is caused when copy-pasting the code.
Also, it is encouraged to use .format()
instead of %
it is encouraged to use .format()
instead of %
for formatting strings.
Use if __name__ == "__main__":
This:
if a > 0:
sgn_a = ""
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
else:
sgn_a = "-"
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
can be shortened to
if a > 0:
sgn_a = ""
else:
sgn_a = "-"
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
There also seems to be an extra indentation (4 spaces) at the start of every line. I'm guessing that it is caused when copy-pasting the code.
Also, it is encouraged to use .format()
instead of %
for formatting strings.
Use if __name__ == "__main__":
This:
if a > 0:
sgn_a = ""
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
else:
sgn_a = "-"
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
can be shortened to
if a > 0:
sgn_a = ""
else:
sgn_a = "-"
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
There also seems to be an extra indentation (4 spaces) at the start of every line. I'm guessing that it is caused when copy-pasting the code.
Also, it is encouraged to use .format()
instead of %
for formatting strings.
Use if __name__ == "__main__":
This:
if a > 0:
sgn_a = ""
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
else:
sgn_a = "-"
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
can be shortened to
if a > 0:
sgn_a = ""
else:
sgn_a = "-"
if b > 0:
sgn_b = "+"
else:
sgn_b = "-"
if c > 0:
sgn_c = "+"
else:
sgn_c = "-"
There also seems to be an extra indentation (4 spaces) at the start of every line. I'm guessing that it is caused when copy-pasting the code.
Also, it is encouraged to use .format()
instead of %
for formatting strings.