Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

C# Exercises

Arrays
1. Arrays

1.1 Exercise: Declare an array

Declare an array called days, set it to length 7

1.2 Exercise: Read and write array values

Set each value of the array to a day of the week.

1.3 Exercise: Loop through the array

Print out all the days of the week

3. Lists
2.1 Exercise: Declare a list

Declare a list called Students

2.2 Exercise: Read and write list values

Write the name of 5 students in your class to the list

2.3 Exercise: Remove an item from the list

Remove one of the names

2.4 Exercise: Remove an item from the list another way

Use a different method to remove another student

2.5 Exercise: Loop through the list

Print out the remaining students


3. Dictionaries
3.1 Exercise: Declare a dictionary

Declare a dictionary called WebColours, with key and value both string

3.2 Exercise: Read and write dictionary values

Add 6 hexadecimal colours and their descriptions to the dictionary

3.3 Exercise: Remove an item from the dictionary using the value

3.4 Exercise: Loop through the dictionary and print out a list of colours and their codes

3.5 Exercise: Output the colour description for a colour code

3.6 Exercise: Output the colour code for a colour description

3.7 Exercise: Write whether or not dictionary contains a colour

3.8 Exercise: Delete last key value pair

You might also like