vendredi 2 octobre 2020

How to write this code in one or two line?

I want to write this code in one line or max two lines...

Input : https://youtu.be/hNUtnu14wzg

required output : hNUtnu14wzg

input : https://www.youtube.com/watch?v=/hNUtnu14wzg

required output : hNUtnu14wzg

x=str(input())[::-1]
videoID=[]
for i in x:
    if i=="/" or i=="=":
        break
    else:
        videoID.append(i)
        
print(''.join(videoID)[::-1])

Aucun commentaire:

Enregistrer un commentaire