28th Feb 2023, 7:11 PM
Andrew The Python Slayer
Andrew The Python Slayer - avatar
7 ответов
+ 5
Andrew The JUMP_LINK__&&__Python__&&__JUMP_LINK Slayer , there is nothing bad with your code. > what do you think can be done better?
28th Feb 2023, 7:54 PM
Lothar
Lothar - avatar
+ 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.
3rd Mar 2023, 1:06 AM
Bob_Li
Bob_Li - avatar
+ 1
Thx:) Maybe you can somehow improve the unpacking to remove the constant crutch?
28th Feb 2023, 7:56 PM
Andrew The Python Slayer
Andrew The Python Slayer - avatar
+ 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.
2nd Mar 2023, 2:39 PM
Brian
Brian - avatar
+ 1
Bob_Li hi, yes, you're right, but as I understand it, the code really came out good :) and yours too
3rd Mar 2023, 7:56 AM
Andrew The Python Slayer
Andrew The Python Slayer - avatar
0
Hello my dear friend how are you doing
2nd Mar 2023, 7:11 PM
Kevin Kentucky
Kevin Kentucky - avatar
0
Kevin Kentucky, hi, everything is fine) I'm analyzing python in detail
2nd Mar 2023, 7:13 PM
Andrew The Python Slayer
Andrew The Python Slayer - avatar