6 kyu

[Code Golf] Optional Walrus?

Description:

Re-write the initial function below so that it is 31 characters or less:

def f(iterable, integer):
    length = len(iterable)
    if length > integer:
        return length
    else:
        return 0

This simple function takes an input iterable and an integer. If the length of the iterable is larger than the integer it returns that length. Otherwise it returns zero. All inputs will be valid and and all iterables will have a defined length.

Restricted
Puzzles

Similar Kata:

Stats:

CreatedMay 21, 2021
PublishedMay 21, 2021
Warriors Trained1084
Total Skips24
Total Code Submissions2498
Total Times Completed424
Python Completions424
Total Stars25
% of votes with a positive feedback rating89% of 138
Total "Very Satisfied" Votes116
Total "Somewhat Satisfied" Votes14
Total "Not Satisfied" Votes8
Total Rank Assessments16
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Chris_Rands Avatar
  • raulbc777 Avatar
  • anter69 Avatar
Ad