Lesson 1/6High school~150 min
Strings
Tasks with text and first complete programs: a digit sum, a cipher, palindromes, a birth number, BMI and a quadratic equation.
You can solve exercises without signing in; sign in and your progress is kept.
After this lesson you'll be able to:
- Walk through a string with a loop and use slices
- Use string methods:
count,split,lower,isdigit - Handle bad input and split a program into functions
- Print exactly what the task asks for - the tests compare the output line by line (trailing spaces do not matter). Write any prompt you like in
input("…"); the tests ignore it.
What you practise here
- String methods: upper, find, replace, …
- Reading numbers from input
- Integer division and remainder: // and %
- Several branches: elif
- Slicing
- Converting types: int(), float(), str()
- Return values: return
- Looping over a string
- Standard modules: math, random
- Input with input()
+ 15
Exam preparation: overview and cheat sheet (in Slovak)
How to approach the tasks, a Python cheat sheet, recurring patterns and worked exam-style problems.
~13 min read · 13 runnable examples
In the notes
Short tasks that check you understand: multiple choice, predicting the output, finding the bug, completing code.
Start the exercisesReal programming tasks: write a program, run it and submit it to be checked, hidden tests included.
Start the challenges- Write a programDigit sumBasic10 XP
- Write a programHalf pyramidBasic10 XP
- Write a programBMI calculatorElementary20 XP
- Write a programFinding a characterBasic10 XP
- Small projectBirth numberIntermediate30 XP
- Write a programThe Fibonacci sequenceElementary20 XP
- Write a programMind readerIntermediate30 XP
- Algorithmic problemGreatest common divisorElementary20 XP
- Write a programA number inside a random numberElementary20 XP
- Write a programCaesar cipherElementary20 XP
- Write a programPalindromeBasic10 XP
- Write a programCharacters and wordsElementary20 XP
- Write a programQuadratic equationElementary20 XP
- Small projectRock, paper, scissorsElementary20 XP
- Write a programPassword checkElementaryOptional20 XP