7 kyu

Char Code Calculation

6,395 of 12,223PG1

Description:

Given a string, turn each character into its ASCII character code and join them together to create a number - let's call this number total1:

'ABC' --> 'A' = 65, 'B' = 66, 'C' = 67 --> 656667

Then replace any incidence of the number 7 with the number 1, and call this number 'total2':

total1 = 656667
              ^
total2 = 656661
              ^

Then return the difference between the sum of the digits in total1 and total2:

  (6 + 5 + 6 + 6 + 6 + 7)
- (6 + 5 + 6 + 6 + 6 + 1)
-------------------------
                       6
Fundamentals
Arrays
Strings
Mathematics

More By Author:

Check out these other kata created by PG1

Stats:

CreatedOct 7, 2016
PublishedOct 7, 2016
Warriors Trained18726
Total Skips778
Total Code Submissions38230
Total Times Completed12223
JavaScript Completions6395
Python Completions3580
Ruby Completions336
Crystal Completions17
PHP Completions433
C Completions348
CoffeeScript Completions14
Haskell Completions121
Clojure Completions57
Rust Completions210
Julia Completions19
NASM Completions16
TypeScript Completions217
C++ Completions395
COBOL Completions8
C# Completions196
Go Completions227
Nim Completions9
Java Completions54
Total Stars168
% of votes with a positive feedback rating91% of 1534
Total "Very Satisfied" Votes1292
Total "Somewhat Satisfied" Votes195
Total "Not Satisfied" Votes47
Total Rank Assessments9
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • PG1 Avatar
  • GiacomoSorbi Avatar
  • raulbc777 Avatar
  • suic Avatar
  • anter69 Avatar
  • user8476848 Avatar
  • donaldsebleung Avatar
  • nbeck Avatar
  • imjasonmiller Avatar
  • declaneugeneleekennedy Avatar
  • JohanWiltink Avatar
  • lilsweetcaligula Avatar
  • Voile Avatar
  • rowcased Avatar
  • metagn Avatar
  • a.kozhanov Avatar
  • hobovsky Avatar
  • stellartux Avatar
  • username0 Avatar
  • SergeySinyavskiy Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
Ad