Back to Browse

Number Words - 28 April 2026 - Python Version on freeCodeCamp

4 views
Apr 28, 2026
7:51

Given its integer from 0 to 99, return its English word representation. Link at https://www.freecodecamp.org/learn/daily-coding-challenge/2026-04-28 Did the Python Version of this challenge. Called the function get_number_words, passing in a number. Then printed it out. If the number is 0, return zero. Used lists for the units one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen and nineteen. If the number is between 1 and 19, return the number that is in the list. Used lists for the tens that are a multiple of 10 - twenty, thirty, forty, fifty, sixty, seventy, eighty and ninety. If the number is a multiple of 10 and it is between 20 and 90, return the word from the tens list. Numbers 21-99, which are not multiples of 10 are written as two words joined by a hyphen. For example, the number 67 returns sixty-seven. Used f-strings to get the two words joined by a hyphen. One word from the tens list and the other word from the units list.c get_number_words(0) should return zero get_number_words(10) should return ten get_number_words(19) should return nineteen get_number_words(30) should return thirty get_number_words(53) should return fifty-three get_number_words(7) should return seven get_number_words(12) should return twelve get_number_words(60) should return sixty get_number_words(67) should return sixty-seven get_number_words(98) should return ninety-eight

Download

0 formats

No download links available.

Number Words - 28 April 2026 - Python Version on freeCodeCamp | NatokHD