Checkpoint 1 Plan

I feel like once I decided to look at each digit place (ones, tens,
hundreds, etc., this plan become more clear to me. As I got to the later
numbers, it seemed to rely heavily on the first parts, but I am eager
to start coding to test it out. If it doesn't work, I may need to adjust
the plan. I am eager to get started.)
This commit is contained in:
Chris Mekelburg 2024-11-02 20:46:13 -04:00
parent 023a2431ba
commit ddc79e7125
1 changed files with 36 additions and 2 deletions

View File

@ -36,20 +36,54 @@ return digit_names[number]
## Integers under 20
If the integer is under 10, then use the procedure described above.
Otherwise, ... (this is where you take over!)
Define some prefixes for numbers greater than 9:
teen_prefix=[ten, eleven, twelve, thir, four, fif, six, seven, eight, nine]
This could go at the top of the code as it will be used later
The number will also need to be broken into 2 parts
11 = 1 and 1
The first one will be tens_digit, the second number will be ones_digit
if number is between 10 and 12
return teen_prefix[tens_digit]
if number is between 13 and 19
return teen_prefix[ones_digit] + teen
## Integers under 100
This time we'll need prefixes but they are a little different because it is fourty and not forty
The first 2 prefixes in the list will not be used but need to be indexed
prefixes= [blank, blank, thir, for, fif, six, seven, eight, nine]
The number will again need to be broken into 2 parts
37= 3 and 7
The first one will be first_digit, the second number will be second_digit
if ones_digit = 0
return prefix[tens_digit] + ty
if ones_digit not equal to zero
return prefix[tens_digit] + digit_name[ones_digit]
## Integers under 1000
Similar story, but now 3 digits
234, 2+3+4, hundreds_digit, tens_digit, ones_digit
return digit_names[hundreds_digit] + hundred + run the function above for integers under 100 and it will get added to this string
## Integers under 1000000
This will now run very similar to digits under 1000, but there will be thousands_digit, ten_thousands_digit, and hundred_thousands_digit
Ex] 984456
return digit_names[hundred_thousands_digit] + hundred + function for numbers less than 100 + thousand + function for numbers less than 1000. I think it's becoming harder to plan this out wihtout seeing how the earlier code works, but it seems logical to me and I feel like I have a plan for all the numbers.
## Negative integers down to -1 million
We won't deal with negative integers in this problem set,
but how would you deal with a negative integer, using the
functions above?
For a negative digit, you would need an if statement that if -, adds the word netative before the name