+ 1
how can I make this code better?
7 Answers
+ 5
Andrew The JUMP_LINK__&&__Python__&&__JUMP_LINK Slayer ,
there is nothing bad with your code.
> what do you think can be done better?
+ 2
Andrew The JUMP_LINK__&&__Python__&&__JUMP_LINK Slayer
you could remove the !=None parts and the code would work the same.
def route_info(distnce=None, speed=None, time=None):
if distnce:
print(f"Distance is {distnce}")
elif speed and time:
print(
f"Distanse is {speed * time}")
else:
print("No information about distanse")
Google truthy and falsy values.
+ 1
Thx:)
Maybe you can somehow improve the unpacking to remove the constant crutch?
+ 1
Andrew The JUMP_LINK__&&__Python__&&__JUMP_LINK Slayer you could improve it by correcting the spelling of "distance" in several places. Otherwise, the code seems fine.
+ 1
Bob_Li hi, yes, you're right, but as I understand it, the code really came out good :) and yours too
0
Hello my dear friend how are you doing
0
Kevin Kentucky, hi, everything is fine) I'm analyzing python in detail