Strings
Contents
Strings#
Read Strings before you start with the exercises.
Character Statistics#
Print a list of all characters appearing in a string. Count how often each character appears without using str.count
. Get the string from user input.
Solution:
# your solution
Unicode Fruits#
Print the string I like apples and melons.
where apples
and melons
shall be replaced by a suitable Unicode symbol.
Solution:
# your solution
Parser#
Write a function which converts a string representation of a table of integers to a list of lists of integers. The elements of a row are separated by commas and rows are separated by semicolons. Test your function with
'1,2,3;4,5,6;7,8,9'
Result should be
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Bonus: Solve the task in one line.
Solution:
# your solution
Spoon Language#
Write a Python script which prompts the user for some input and translate user input to spoon language.
Hint: Simple replacement does not work. If, for instance, at first a is replaced by alewa, subsequent replacement of e will alter the lew in alewa. There seems to be no replacement order for vowels working correctly in each case. Thus, in a first run replace all vowels by some code (unlikely to appear in a text), then, in a second run, replace the codes by the vowel’s lew-version.
Solution:
# your solution