Kotlin for Python Developers
Move from Python to Kotlin through null safety, collection ownership, functions, properties and object contracts. Build a connected multi-file order processor and port a stock ledger.
Python and Kotlin side by side
The same program in Python and in Kotlin, from the lessons of this course.
Strings and Templates
Python f-strings mark interpolation with an f prefix and braces. Kotlin uses dollar templates inside ordinary strings. Python executes module-level statements when a module runs or imports, whereas this Kotlin runner invokes one top-level main. Supporting…
Python1ready = 32print(f"Ready: {ready}")Kotlin1fun main(){2val ready=33println("Ready: $ready")4}Equality and Identity
Python == delegates to value equality and is tests object identity. Kotlin == likewise uses equality semantics, while === tests reference identity. Python lists compare element values by default; Kotlin arrays need contentEquals rather than ordinary array ==…
Python1a = "".join(["t", "e", "a"])2print(a == "tea")Kotlin1fun main(){2val a=String(charArrayOf('t','e','a'))3val b=String(charArrayOf('t','e','a'))4println(a==b)5}Arrays and IntArray
Python lists grow and allow negative indexes. Kotlin Array and IntArray are fixed-size and reject negative indexes. Use last or a valid size-based index to express end access, and MutableList when growth is required. Python slices also create new lists, while…
Python1values = [4, 8, 12]2print(values[-1])Kotlin1fun main(){2val a=intArrayOf(4,8,12)3println(a.last())4}While, Break, and Continue
Python for and while support else clauses that run when the loop finishes without break. Kotlin has no loop-else syntax; track the needed condition explicitly. Both languages distinguish continue from break. This demonstration skips a blank word and breaks at…
Python1kept = []2for word in ["tea", "", "STOP", "coffee"]:3 if word == "STOP":4 break5 if not word:6 continue7 kept.append(word)8print(",".join(kept))Kotlin1fun main(){2val kept=mutableListOf<String>()3for(word in listOf("tea","","STOP","coffee")){if(word=="STOP")break;if(word.isEmpty())continue;kept.add(word)}4println(kept.joinToString(","))5}Top-level Functions
Python functions may be module-level and use positional or keyword arguments. Kotlin also allows top-level functions, but its declarations have static parameter types. Python returning None implicitly differs from a Kotlin non-Unit function, which needs a…
Python1def is_long(text: str) -> bool:2 return len(text) > 43 4print(is_long("coffee"))Kotlin1fun isLong(text:String):Boolean = text.length>42fun main(){3println(isLong("coffee"))4}Input and String Formatting
Python strip and upper provide familiar normalization operations, but Python string length counts Unicode code points rather than JVM Kotlin UTF-16 code units. Grapheme clusters require a further text model in either language. ASCII examples keep these…
Python1print(" tea ".strip().upper())Kotlin1fun main(){2println(" tea ".trim().uppercase(java.util.Locale.ROOT))3}
Syllabus
10 chapters48 lessons1 project48 challenges99 quiz questionsStarting Kotlin
6 lessonsValues and Decisions
5 lessonsCollections and Ownership
5 lessonsIteration and Transformations
5 lessonsFunctions and Callbacks
5 lessonsInput, Errors, and Files
5 lessonsClasses and State
6 lessonsComposition and Value Types
5 lessonsProject: Order Processing
4 lessonsFinal Challenges
2 lessonsFrequently asked questions
Who is Kotlin for Python Developers for?
For people who already write Python and want to learn Kotlin. Each lesson starts from Python you know and shows how Kotlin does the same thing, so you skip the beginner basics.
Do I need to know Kotlin already?
No. The course starts with your first Kotlin program. You need Python basics: variables, conditions, loops, functions and collections.
How many lessons does Kotlin for Python Developers have?
Kotlin for Python Developers contains 48 interactive lessons you can complete at your own pace.
What does Kotlin for Python Developers cover?
The course is organized into chapters covering: Starting Kotlin, Values and Decisions, Collections and Ownership, Iteration and Transformations, and more.
Is Kotlin for Python Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.