WEEKDAY: Digits vs Letters
⚠️!!SPOILERS IN COMMENTS!!⚠️
⚠️!!SPOILERS IN COMMENTS!!⚠️
⚠️!!SPOILERS IN COMMENTS!!⚠️
🔑 KEY RULE: Upload your answer in PDF only, raw spoilers will be deleted.
_____
Challenge starts below this line of text.
=====
You've just gained access to a compromised server during an authorized pen-test. Buried in the logs is a stream of suspicious strings. Some are passwords packed with numbers, others are usernames made of letters, and some are junk. Before you can crack anything, you need to triage each string fast.
Your job is to write a function, digits_or_letters(s), that classifies each intercepted string:
  • Return "digits" if the string contains more digits than letters.
  • Return "letters" if it contains more letters than digits.
  • Return "tie" if the counts are equal.
Rules of engagement:
  • Digits are 0-9
  • Letters are a-z, upper or lower case
  • Everything else (spaces, symbols, special characters) is noise. Ignore it.
Your code should pass all the tests:
1. digits_or_letters("abc123") should return "tie".
2. digits_or_letters("a1b2c3d") should return "letters".
3. digits_or_letters("1a2b3c4") should return "digits".
4. digits_or_letters("abc123!@#DEF") should return "letters".
5. digits_or_letters("H3110 W0R1D") should return "digits".
6. digits_or_letters("P455W0RD") should return "tie".
=====
Goodluck.
~ aScriptKiddie
3
1 comment
Bree Kagwe
4
WEEKDAY: Digits vs Letters
powered by
The Black Widow Community
skool.com/bree-1280
Get Paid To Hunt Bounties, Solve CTF's & Compete For Gadgets.
It's all here.
Want to become an ethical hacker? We built this community for you.
Build your own community
Bring people together around your passion and get paid.
Powered by