0

No output in python?

By creating an if , elif conditions If the if condition is false The elif condition is not checking and its giving only 'No output ' in console . https://code.sololearn.com/ca2f7vFR6TCh/?ref=app If This youtube url is input https://youtu.be/k8SXsT5TLxQ Its displays no output...

26th Mar 2020, 10:24 AM
TeckgeekARJ
TeckgeekARJ - avatar
5 Respuestas
+ 2
Jaya Balan A R When making a function you need () at the end. def functioname(): You can pass 'a' inside these parentheses and remove from the first line. You must call a function otherwise it would never run. How to call a function? Simply write, print(functionname()) if 'a' is the parameter inside so u can pass the input like, print(functionname("habzhshanzbhsjanahshsjah") You should have RETURNS instead of PRINTS inside ur function, otherwise they can return an output 'None' which u dont want.
26th Mar 2020, 11:46 AM
maf
maf - avatar
+ 2
Can you please send the code so that I can help you?
26th Mar 2020, 10:32 AM
Taranjeet
Taranjeet - avatar
+ 2
to check if a string B is a substring of a string A, use 'if B in A' . so the code will be: a=input() b='watch' c='youtu.be' def utubeid(sring) if b in string: return a[32:] elif c in string: return a[17:] print(utubeid (a))
26th Mar 2020, 11:29 AM
John Robotane
John Robotane - avatar
+ 1
the problem is that if none of those conditions is satisfied, the return value will be None. you must take this in account.
26th Mar 2020, 11:34 AM
John Robotane
John Robotane - avatar
+ 1
Thanks for the answers and suggestions I solved it ...😊😊
26th Mar 2020, 11:49 AM
TeckgeekARJ
TeckgeekARJ - avatar