In this section you will find tasks based on strings and sting manipulation.
Reverse polish notation is a postfix notation for calculations. Instead of writing 1 + 2 we would write 1 2 +. Why? Well RPN does not need brackets to begin with! You can find more information about RPN by following the link below. http://www.calculator.org/rpn.aspx (information about reverse polish) Your task is to read in a string […]
Write a program which will • Loop over a sentence the sentence “This is a sentence with a few words in” • Starting at the left, look at each letter and store it in a temporary variable. • When you see a space, print out “I have seen the word” followed by the word. • […]
It would be great to have a banner at the start of your programs which looks like this – ********************************* –Mr Hamflett’s awesome program– ********************************* You are to write a program which, given any input, will display a banner like the one above. It must ensure that their are enough stars! So the following is […]
The popular video games Fallout 3 and Fallout: New Vegas has a computer hacking mini game. This game requires the player to correctly guess a password from a list of same length words. Your challenge is to implement this game yourself. The game works like the classic game of Mastermind The player has only 4 guesses and on each incorrect guess the […]
Using ord() and chr(), encrypt a sentence using the Caesar cipher. You can find out how it works on the link below – http://en.wikipedia.org/wiki/Caesar_cipher You need to log in or create an account to submit code!
Read http://en.wikibooks.org/wiki/Non-Programmer’s_Tutorial_for_Python_2.6/Revenge_of_the_Strings http://code.linuxnix.com/2013/11/pfotd-python-ord-function-examples.html http://www.asciitable.com/ Using the above commands, produce the ASCII table from upper case a to lower case Z. The last link above shows the ascii values. When displaying the ASCII table you should show the integer number and the character only. You should also use a loop. You need to log in or […]
Write a program which will ask as input a word (no more than 7 characters). It will then produce the patterns shown below. These are known as parallelogram words due to the shape they produce. Looking at the word “hello” we would print 4 spaces and a h 3 spaces and then he 2 spaces […]
Given any number, convert it into words. Some examples are shown below – 14 = one four 9 = nine 1052 = one thousand zero hundred fifty two 76 = seventy six In order to do this problem you will want to store the possible permutations into an array. The example code below gives you […]
Algebra is like marmite, you either love it or hate it! However, algebra is very important to computer scientists as we are very used to given variables numbers! Linear equations are equations which are in the form – y =ax + c For example – y = 2x + 1 y = 4x + 7 […]
Before attempting this problem, you need to have attempted the ‘String Extraction’ example above. … Now that you know how to extract / manipulate strings, try the problem below. Write a program that gets the user to input a string and reverses the string as output You need to log in or create an account […]
Write a program that gets the user to input a string and outputs if the string is a palindrome (word that spells the same backwards and forwards) or not. Examples of palindromes Hannah, A Santa at Nasa, Civic, Amore Roma You need to log in or create an account to submit code!