30 Days of Code — Day 5

Tyler Carter
2 min readMar 8, 2021

--

Photo by Shahadat Rahman on Unsplash

As a forcing function to get myself into the habit of writing these articles — I have decided to write an article for each day of the 30 Days of Code challenge from Hacker Rank.

The Task

Given an integer, n , print its first 10 multiples. Each multiple n x i(where 1 ≤ i ≤ 10) should be printed on a new line in the form: n x i = result.

The Code

The Result

>? 12
...: 12 x 1 = 12
...: 12 x 2 = 24
...: 12 x 3 = 36
...: 12 x 4 = 48
...: 12 x 5 = 60
...: 12 x 6 = 72
...: 12 x 7 = 84
...: 12 x 8 = 96
...: 12 x 9 = 108
...: 12 x 10 = 120

Conclusion

This one was very easy. I have had a lot of experience defining functions and using inputs previously. I tried to make the code for this one a little more generic by using the format method in the print function. I am trying to get into the mindset of not creating scripts to do one specific thing. I am trying to keep my mind on creating programs that are flexible and agile.

Here is a link to the day_4 answer/challenge I wrote about previously: 30 Days of Code — Day 4.

--

--

Tyler Carter
0 Followers

I am currently an Operations Program Manager for Microsoft. I have been teaching myself Python to use for Data Analytics and Machine Learning.