**Links to example code**
**Right click and "save link as" to get the .py file**
Problem Solving Workshop Python Example
HTML Gradient Example
SymPy Simplification Tutorial
If you want to become a good problem solver, you gotta solve lots of problems!
Solving problems is the core of computer science.
Programmers must first understand how a human solves a problem, then understand how to translate this "algorithm" into something a computer can do,
and finally how to "write" the specific syntax (required by a computer) to get the job done.
It is sometimes the case that a machine will solve a problem in a completely different way than a human.
Some problems to help get you started. Feel free to ask for help on any of these!
• Write a function that given a string and a number n, prints a new string made of n copies of the original string.
o For an added bonus, print the copies of just the last 2 chars of the original string.
• Enter a string and the program will reverse it and print it out.
• Write a function that given a string, print a version without the first and last characters, so "Hello" yields "ell".
• Counts the number of individual words in a string. For added complexity read these strings in from a text file and generate a summary.
• Checks if the string entered by the user is a palindrome. That is that it reads the same forwards as backwards like “racecar”
Sherlock and Squares (HackerRank)
• Write a program which reads integers from standard input and sorts them using the Bubblesort algorithm.
o Bubble sort is a sorting algorithm that works by repeatedly stepping through lists that need to be sorted,
comparing each pair of adjacent items and swapping them if they are in the wrong order.
This passing procedure is repeated until no swaps are required, indicating that the list is sorted.
Bubble sort gets its name because smaller elements bubble toward the top of the list.
Pythagorean tiles(Project Euler)
• A goat, a wolf and a salad are on one side of a river and you need to get them to the other side using your boat. You can carry one item in your boat to the other side at any given time. However, when the goat and the wolf are left alone the wolf will eat the goat. If the goat and the salad are left alone the goat will eat the salad. As long as you are with them nothing will happen, i.e. the wolf won’t eat the goat and the goat won’t eat the salad. Write a program which determines algorithmically an order in which you carry them all to the other side.
• HackerRank is a great resource for a wide range of problems. They have a great layout that makes finding beginner, intermediate and advanced problems really easy. It also has a really awesome/useful programming environment as a plugin on the website.
• Well known website with lots of computational problems with immediate feedback.
Reddit - DailyProgrammer
• This is a great subreddit with so many different challenges. Also a good community for asking questions and finding solutions.
Reddit - ProgrammingChallenges
• Definitely some good stuff in this subreddit, but much smaller than DailyProgrammer.
Reddit - 1000 Beginner Programming Projects
• Giant list of really good projects to try.
• The hacker.org challenges are a series of puzzles, tricks, tests, and brainteasers designed to probe the depths of your hacking skills.
James Supplemental Handout: