Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
python_study_note_return@if@elif@else
def convert_seconds(seconds): hours = seconds // 3600 minutes = (seconds - hours * 3600) // 60 remaining_seconds = seconds - hours * 3600 - minutes * 60 return hours, minutes, remaining_seconds print(convert_seconds(5000)[0]) ## output 1 : return def hint_username(username): if len(username) < 3: print("Invalid") else: print("Valid") hint_username("melvin") ## output 2 : if and else def is_even(number): if number % 2 == 0: return True return False print(is_even(3)) ## output 3 : if and else def hint_username(username): if len(username) < 3: print("Invalid") elif len(username) > 15: print("Too long for the username, Invalid") else: print("Valid") hint_username("melvinabcdfgabcbceicbhweicbhwib") ## output 4 : if, elif and else
run
|
edit
|
history
|
help
0
947
if else
StAr
alternative dict.get (faster)
raja praja
PyLSV
dictionary function
mbti
gj4
I_Love_India