6 kyu
[Code Golf] Optional Walrus?
424Chris_Rands
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:
Created | May 21, 2021 |
Published | May 21, 2021 |
Warriors Trained | 1084 |
Total Skips | 24 |
Total Code Submissions | 2498 |
Total Times Completed | 424 |
Python Completions | 424 |
Total Stars | 25 |
% of votes with a positive feedback rating | 89% of 138 |
Total "Very Satisfied" Votes | 116 |
Total "Somewhat Satisfied" Votes | 14 |
Total "Not Satisfied" Votes | 8 |
Total Rank Assessments | 16 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |