4 Fantastic Beginner Python Programming Challenges to Really Test Your Knowledge

Aryaman Kukal
Jun 11, 2020 · 4 min read
Image for post
Image for post
Credited to: educative.io

Programming is not all about memorizing syntax and knowing every single function every made at the top of your head. It’s about knowing how to apply a strong base of fundamental knowledge to intricate, complex, logic-based, situations.

Before you get to building apps and advanced software like that, you need to master mind-bending and thought-provoking logic. Logical programs that, after reading them, send you deep in thought and analysis.

The following programs will, for majority of you, do just that. They’ll make you think like you’ve never thought before.

They’re not arduous, but they’re not straightforward or simple either.

Since the purpose of this article is for the reader to try solving these programs themselves, I won’t be giving an in-depth explanation of each solution. Just the solution code at the very end. And remember, a single problem can have many solutions. Mine can look completely different from yours, but in the end, it’s the output that matters. However, it won’t help if you code carelessly. For example, copy and pasting a huge chunk of code whereas a simple for loop can do the job.

1. The Star Triangle Pattern

Given an input by the user in the form of a positive integer, the program should print out a triangle-shaped pattern made of the star character (*). The input should be stored in a variable called N. N represents the number of rows in the pattern. The number of stars in each row increases by 2 each time.

For example:

If N = 3

If N = 4

2. Sum of Integers in String

Given a sentence or cluster of words, find out if there are any integers inside the string. Print out the total number of integers. If there’s at least 1 integer present, find the sum of all of the integers found and print out the sum.

For example:

If string = “200 plus 500 is equal to”

3. FizzBuzz

Cycle through every number from 1 to some number that the user provides as input. (only integers) and print each one onscreen. If the number is divisible by 4, then instead of printing the number itself, print “Fizz”. If the number is divisible by 6, then instead of printing the number itself, print “Buzz”. If the number is divisible by both 4 and 6, print “FizzBuzz”. If the number doesn’t satisfy any of these conditions, simply print the number itself.

For example:

If max = 13

The range would be 1 to 13

4. Sum of Two

Create a function called sumOfTwo(a, b, v) with 3 parameters.

a is a list of integers, such as [22, 341, 21, 5, 0, -5].

b is also a list of integers, just like a.

v is a single integer.

The function should check if it is possible to take one number from both list a and b, and add the numbers together to equal the number v.

If there are 2 numbers that can do this, print “True”. Otherwise, print “False”.

For example:

The output would be “True” because 3+ 20 = 23.

Possible solutions:

1. The Star Triangle Pattern

2. Sum of Numbers in String

3. FizzBuzz

4. Sum of Two

Happy coding! Stay safe during these times.

The Startup

Medium's largest active publication, followed by +756K people. Follow to join our community.

Aryaman Kukal

Written by

tech enthusiast ~ programmer ~ avid writer ~ always curious; rarely express it ~ freshman @ American High ~ “Make it work, make it right, make it fast.”

The Startup

Medium's largest active publication, followed by +756K people. Follow to join our community.

Aryaman Kukal

Written by

tech enthusiast ~ programmer ~ avid writer ~ always curious; rarely express it ~ freshman @ American High ~ “Make it work, make it right, make it fast.”

The Startup

Medium's largest active publication, followed by +756K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store