Retired

Check the URL (retired)

Description:

You are working for ALDI's and your latest job is to make sure each stores website URL and ID are valid.

The only allowed scheme is 'https:'. If the scheme is invalid you must return "{scheme} is an invalid scheme." The ID must be 4 or 5 charecters long and has only 0-9 digits. If the ID is 4 chars long you must add a 0 to it. Once this is done the ID may not begin with "00". If the ID is invalid you must return "{store_id} is an invalid store ID.".If the ID and the scheme are invalid return "{scheme} is an invalid scheme.{store_id} is an invalid store ID.". If neither is invalid then return the ID.


Notes and clearing things up:

The scheme will be everything before the first "/". The ID will be everything following the last "/"

A URL is valid if all of the following are true

1.The scheme (every charecter before the first "/") has to equal "https:"

2.The Id (every charecter after the last "/") has to have a length of five or four

If the Id is four charecters long at this point you would add a "0" to the begining

3.The modified Id does not start with "00"

The scheme is invalid if statement 1. is not true. The ID is invalid if either statement 2. or 3. are false.

If you are confused about outputs when either the ID or protocol is invalid protocol_string = "{whatever the protocol is} is an invalid protocol." Id_string = "{Id} is an invalid store ID.".The returned string should have the protocol_string if the protocol is invalid and the Id isn't. If the ID is invalid but the protocol isn't you should return Id_string. When both are invalid return protocol_string+Id_string. If this is not what you're talking about, I do not quite understand what you are saying.


Examples:

    check_url("https://URL.com/21634")-->"21634"
    check_url("https://URL.com/123456")-->"123456 is an invalid store ID."
    check_url("fttps://BlahBlahBlah.com/2163")-->"fttps: is an invalid scheme."
    check_url("https://thisDoesn't.matter/1634")-->"01634"
    check_url("https://URL.com/00634")-->"00634 is an invalid store ID."
    check_url("https://URL.com/0634")-->"00634 is an invalid store ID."
    check_url("hs://UL.com/4")-->"hs is an invalid scheme.4 is an invalid store ID."
Strings

Similar Kata:

Stats:

CreatedOct 9, 2024
Warriors Trained12
Total Skips0
Total Code Submissions29
Total Times Completed10
Python Completions10
Total Stars0
% of votes with a positive feedback rating36% of 7
Total "Very Satisfied" Votes1
Total "Somewhat Satisfied" Votes3
Total "Not Satisfied" Votes3
Total Rank Assessments6
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • dietrichR Avatar
Ad