How to resolve the algorithm SEDOLs step by step in the Potion programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm SEDOLs step by step in the Potion programming language

Table of Contents

Problem Statement

For each number list of 6-digit SEDOLs, calculate and append the checksum digit.

That is, given this input: Produce this output: Check each input is correctly formed, especially with respect to valid characters allowed in a SEDOL string.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm SEDOLs step by step in the Potion programming language

Source code in the potion programming language

sedolnum = (c) :
   if ("0" ord <= c ord and c ord <= "9" ord): c number integer.
   else: 10 + c ord - "A" ord.
.

sedol = (str) :
   weight = (1, 3, 1, 7, 3, 9)
   sum = 0
   6 times (i) :
      sum = sum + sedolnum(str(i)) * weight(i)
   .
   (str, (10 - (sum % 10)) % 10) join
.

  

You may also check:How to resolve the algorithm Multiplicative order step by step in the Ada programming language
You may also check:How to resolve the algorithm Minimal steps down to 1 step by step in the J programming language
You may also check:How to resolve the algorithm Take notes on the command line step by step in the UNIX Shell programming language
You may also check:How to resolve the algorithm Bitmap/PPM conversion through a pipe step by step in the Phix programming language
You may also check:How to resolve the algorithm Real constants and functions step by step in the Wren programming language