Skip to content

yonice7/exercises-python-solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Very Good Site with Python Exercises

These are the solutions I coded in python for the exercises that you can find here

Solutions

Solutions to exercises from 1 to 19
There are some exercises I haven't solved yet.

Problem descriptions:

Problem 1: Sum "A+B" You are to add two numbers and tell their sum.

Problem 2: Sum in Loop You are to find sum of several numbers (more than two).

Problem 3: Sums in Loops You will be given several pairs of values and you need to calculate sum for each pair.

Problem 4: Minimum of Two Of two numbers, please, select one with minimum value.

Problem 5: Minimum of Three Several triplets of numbers are given to you. Your task is to select minimum among each of triplets.

Problem 6: Rounding There are several pairs of numbers. For each pair you are to divide first by second and return the result, rounded to nearest integer. In cases, when result contains exactly 0.5 as a fraction part, value should be rounded up.

Problem 7: Fahrenheit to Celsius You are to write program to convert degrees of Fahrenheit to Celsius.

Problem 8: Arithmetic Progression Calculate sums of arithmetic progression.

Problem 9: Triangles You are given several triplets of values representing lengths of the sides of triangles. You should tell from which triplets it is possible to build triangle and for which it is not.

Problem 10: Linear Function Your task is to determine a and b by two points, belonging to the function. I.e. you are told two pairs of values (x1, y1), (x2, y2) which satisfy the function equation - and you should restore the equation itself.

Problem 11: Sum of digits Find the sum of (A*B) + C and then find the sum of that sum's digits for each line.

Problem 12: Modulo and time difference Calculate the difference in days, hours, minutes, and seconds between two times.

Problem 13: Weighted sum of digits Calculate the weighted sum of digits.

Problem 14: Modular Calculator Find the remainder of the result of all operations applied sequentially (starting with initial number) divided by the last number.

Problem 15: Maximum of array Input data will give you exactly 300 numbers in a single line. Answer should contain maximum and minimum of these values, separated by space.

Problem 16: Average of an array You will be given several arrays, for each of which you are to find an average value. 0s do not count. All answers rounded.

Problem 17: Array Checksum Calculate the checksum for an array.

Problem 18: Square Root Write a program using Heron's method to generate square roots within at least 1e-7 = 0.0000001 of accurancy.

Problem 19: Matching Brackets Check a series of strings and return for each string if all brackets within have been used in the correct sequence.

Problem 20: Vowel Count You will be given several lines of text - and for each of them you should tell the number of vowels (i.e. letters a, o, u, i, e, y). Note: that y is regarded as vowel for purpose of this task.

Problem 21: Array Counters Here is an array of length M with numbers in the range 1 ... N, where N is less than or equal to 20. You are to go through it and count how many times each number is encountered.

Problem 22: Two Printers Using two printers working together that print at different speeds, determine the shortest amount of time required to print a document. Note: All pages have to be completely printed. 2 printers printing at 1 page per second make 5 pages in 3 seconds, not 2.5 seconds.

Problem 23: Bubble in Array Swap values in an array of numbers so that if a number is greater than the one before it their places are switched. Then display the amount of swaps made and the checksum of the final solution.

Problem 24: Neumanns' Random Generator You will be given initial numbers for several sequences. For each of them report the number of iterations needed to come to repetition using Neumann's Random Generator.

Help

Since this is my second approach to problem solving with python I gotta say that I'm receiving tons of help from this reppository by @ValeWasTaken if you are a self-taught programmer and you are just starting in this world, no matter how much time you dedicate into studying, there are going to be problems that you won't know how to solve. That's why I think we need help from more experienced and talented people. We should't condemn newbies to solve every single problem on their own just because "that's how you really learn". It's still a long way to go before I consider myself good at Python, but if I would just solve problems on my own, I would still be solving very simple ones with no improvement whatsover. Needless to mention that I try to solve every single problem on my own, but when I'm really stucked, and we're talking about hours without any idea on what to do, that's when I look for help. Those were my two cents.


If you have any comment, suggestion or feedback, feel free to reach out.

About

Codeabbey python solutions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages