Improve and simplify YouTube link finder | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Improve and simplify YouTube link finder

Hi! I'm a beginner, but this medium code coach solved easily enough. Is there a way to simplify and improve my code? https://code.sololearn.com/c8rdEG4FMnX1/?ref=app

27th Oct 2020, 7:35 PM
Danil Sinopsky
Danil Sinopsky - avatar
4 Answers
+ 3
Have one line of code search backward from the end of the input string for either '=' or '/', then in the next line print everything after that location to the end of the string.
28th Oct 2020, 5:14 AM
Brian
Brian - avatar
+ 2
In business I would use regex, but in this challenge I shamelessly exploited that the id is at the end and has constant length. This is my solution in python: print(input()[-11:])
27th Oct 2020, 10:07 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 2
Wow! Thanks!
28th Oct 2020, 8:40 AM
Danil Sinopsky
Danil Sinopsky - avatar
+ 1
Ahahah, that's awesome
27th Oct 2020, 10:10 PM
Danil Sinopsky
Danil Sinopsky - avatar