7 kyu

C is for Codewars

329 of 524brodiemark

Description:

Task:

Build a string representing a capital letter C of a given size out of 'C' characters.

Examples:

generate_C(1) 
generateC(1) 
GenerateC(1)

should return this string:

CCCCC
C
C
C
CCCCC
generate_C(2) 
generateC(2)
GenerateC(2)

should be

CCCCCCCCCC
CCCCCCCCCC
CC
CC
CC
CC
CC
CC
CCCCCCCCCC
CCCCCCCCCC

and so on. Given size, the string should have 5*size lines, following the format above. size is a positive integer ≤ 2000.

Note that extra spaces after the C's in any line are incorrect. And the last line should not terminate with "\n".

This kata was inspired by A for Apple, but takes a different approach to generating letters.

Strings
ASCII Art

More By Author:

Check out these other kata created by brodiemark

Stats:

CreatedDec 14, 2024
PublishedDec 15, 2024
Warriors Trained1049
Total Skips33
Total Code Submissions1288
Total Times Completed524
Python Completions329
Java Completions104
C# Completions39
Lua Completions16
Swift Completions43
Kotlin Completions24
Total Stars10
% of votes with a positive feedback rating90% of 88
Total "Very Satisfied" Votes73
Total "Somewhat Satisfied" Votes12
Total "Not Satisfied" Votes3
Total Rank Assessments23
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • brodiemark Avatar
  • dfhwze Avatar
  • PetitLu117 Avatar
Ad