Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .gradle/7.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 14 additions & 4 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
fun main(args: Array<String>) {
//Q1 Part 1
var meMap = mutableMapOf<String,String>("Dr." to "Amal","Eng." to "Sara","T." to "Ali") //Create a map from 3 elements
println(meMap) // For adding to map write
meMap.putIfAbsent("Pro","Ahmed") //Add to map
println(meMap)
meMap["Pro"]="Ragad" //edit the value from the key
println(meMap)
meMap.remove("T.") // remove the value T.Ali
println(meMap)


// your code here



//--------------------------------------------------------------------------
//Part 2
var meMap2 = mutableMapOf<Int,String>(3 to "Food", 4 to "Soda", 5 to "Snacks") // Create a map from 3 elements
meMap2.putAll(listOf("Apple","Juice","Chips").mapIndexed{index, item -> index.toInt() to item}) // Create a list of 3 elements and add it to map
println(meMap2)
}