7 kyu
[Code Golf] - Oddity Count
54MLYTC1
Description:
Task
You are given a positive integer n, and your goal is to compute the count of odd digits in the number n.
Special Condition
You need to count how many digits in n are odd (1, 3, 5, 7, 9).
Constraints
- The input n will be a positive integer such that 5 ≤ n ≤ 9999999.
- The result should reflect the count of odd digits in the number n.
- Code golf restriction: maximum solution length of 37 characters.
Example
For instance:
The count of odd digits in 234 is 1 (only the digit 3 is odd).
For the number 405, the count of odd digits is 1 (only 5 is odd).
For the number 111, the count of odd digits is 3 (all digits are odd).
For the number 2468, the count of odd digits is 0 (all digits are even).
You cannot use built-in functions (like str(), eval(), sum(), etc.)
You also cannot import any external modules or libraries.
Good luck!
Mathematics
Algorithms
Restricted
Similar Kata:
Stats:
Created | Nov 19, 2024 |
Published | Nov 19, 2024 |
Warriors Trained | 230 |
Total Skips | 7 |
Total Code Submissions | 1471 |
Total Times Completed | 54 |
Python Completions | 54 |
Total Stars | 8 |
% of votes with a positive feedback rating | 87% of 23 |
Total "Very Satisfied" Votes | 17 |
Total "Somewhat Satisfied" Votes | 6 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 10 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |