IACS Computes! 2019

IACS Computes! High School summer camp

Binder

Day 1

Day 2

Day 3

Day 4

Day 5

Day 6

Day 7

Day 8

Day 9

View the Project on GitHub harpolea/IACS_computes_2019

Practice problems (on everything)

Disclaimer: problems 2, 3 are taken from https://www.hackerrank.com/. Problem 4 is just slightly inspired by it. :)

Problem 1.

Here, we are given a list of programming languages used in different projects. There are repetitions, of course – same language might have been used somewhere else! Our task is to analyze the list and print the following information:

For example:

Python and Java are the most popular languages for those projects.

Lisp is the least popular one.



Problem 2.

Julius Caesar protected his confidential information by encrypting it using a cipher. Caesar’s cipher shifts each letter by a number of letters. If the shift takes you past the end of the alphabet, just rotate back to the front of the alphabet. In the case of a rotation by 3, w, x, y and z would map to z, a, b and c.

For example, given the rotation by 3:

Write a function that decyphers the encoded words. Start by creating a dictionary that gives a correspondence of original vs. encoded letters.




Problem 3.

Here, our task is to count the number of words in the input string. Alice wrote a sequence of words in CamelCase as a string of letters that has the following properties:

For example, helloThere and helloBeautifulWorld are camel case, but HelloThere or hellothere are not. Your task is to write a function to count the number of words in the camel case string.


Problem 4.

This problem will have two parts. First, we will ask input from the user in order to fill the phonebook. Second, we will write a look-up function in order to retrieve the needed phone numbers.

Sub-problem 4.1

Create a dictionary and save phone numbers in it. Keep asking user for the input until they print stop.


Sub-problem 4.2

Now that you have a dictionary, write a function that takes that dictionary and a name as input, and returns the corresponding phone number. Handle the case if the phone number is not found in the dictionary.


Back to day 6