Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
a = int(input("..."))
# diff = abs(17-a)
# edit: i just saw you don't need the abs
diff = 17 - a
print("...", diff) # the arguments are joined by spaces. no need for the final space in the string
if a > 17:
double = a * 2
print("...", double) # see above -
@gitreflog and it could still be shorter since both variables are used only in one place
-
1) no need to declare c twice. It holds the same value, so just declare it outside the if-else conditions
2) technically your code doesn't even need the else block, the only 'true' code running after the check, is to get th value of 'd'. So you should only use the "if" check. -
512GB6857yName your variables correctly!
Name your variables correctly!
Name your variables correctly!
Name your variables correctly!
ðŸ˜
Related Rants
Hey guys, need an opinion.
Please have a look at the picture and let me know if it's a good practice to code like that. The code still works and I still get the output.
question
python