ChallengesWithPython for Beginners
simple programming challenges for beginner python learners.
(اگر فارسی زبان هستید میتونید به لینکی که توی بالای صفحه قرار دادم مراجعه کنید و لذت ببرید!)
First of all, I'm still (28 Dec 2017) a beginner programmer and there is a lot to learn. but here, You will see the challenges I coped with while I was learning Python. These challenges are not rated by difficulty or etc; but when you see the Soloutions, you will understand their simplicity.
If you have better ideas or challenges in your mind, feel free to help me. :)
no. 1 ) Factorial
write a function which calculates the factorial of a given number. (you can't use math library.)
that simple! try using recursion for solving this problem.
*(in case you don't remember, 4! = 4 * 3 * 2 * 1 = 24)
no. 2 ) Simple Text analyzer
write a program which tells us the number of upper case, lower case and numbers and other characters in it. (Using lists is the best way to solve this challenge. don't use built-in functions such as upper(), lower(). )
try to make the output more beautiful using formatters.
no. 3 ) SuperRoot (nth root)!
write program which receive the number, the root grade (n) and a float value called error as input and generates the nth root of the given number. let's call it superRoot!
for example: num=5, n=3, error=0.001 : superRoot = 1.7000000000000013. we don't want it to be perfect!
no. 4 ) Derivative
write a program that calculates the Derivative of a certain function in a point that we give. you can ask for the value of error separately, just like previous challenge! (it looks hard but it isn't actually! it's much simpler than you think!)
no. 5 ) Integration
Just same as the previous challenge! but this time, the input is two points. if you have done the previous challenge, this one will be so simple for you!
no. 6 ) Prime number identifyer and generator!
You certainly know about prime numbers from high school. make a program which tells us that the given (input) number is eather prime or not. then do something that generates the prime numbers and adds them into a list.
no. 7 ) Chinese heads and legs puzzle
We count 35 heads and 94 legs among the chickens and rabbits in a farm. How many rabbits and how many chickens do we have? solve this problem using progemming! Is this puzzle solvable for any amount of legs and heads? no? so write a function that extends the problem to any given amount of legs and heads and returns either the count of chickens and rabbits or tells us that the problem is unsolvible for given inputs. then right a function that returns all possible pairs of legs and heads in a given range (input) as a dictionary.