List Exercises
List Exercises
List Exercises
Exercise #1
Exercise #1
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
If the number 5 is in the list print “list has 5”
If the number 5 is in the list print “list has 5”
Solution
Solution
Exercise #2
Exercise #2
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
Add 3 to each number in the list
Add 3 to each number in the list
Solution
Solution
Exercise #3
Exercise #3
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
Make each number in the list an even number
Make each number in the list an even number
Solution
Solution
Exercise #4
Exercise #4
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]
Change the odd numbers to even numbers but leave the even numbers the same
Change the odd numbers to even numbers but leave the even numbers the same
Solution
Solution
Exercise #5
Exercise #5
word = “Kerfuffle”
word = “Kerfuffle”
Write a program that prints each letter in word
Write a program that prints each letter in word
Solution
Solution
Exercise #6
Exercise #6
word = “Kerfuffle”
word = “Kerfuffle”
Write a program that makes every other letter of word capital.
Write a program that makes every other letter of word capital.
Example : KeRfUfFlE
Example : KeRfUfFlE
Solution
Solution
Exercise #7
Exercise #7
nums = [86, 71, 62, 93, 54, 78, 93, 121, 104, 125, 89]
nums = [86, 71, 62, 93, 54, 78, 93, 121, 104, 125, 89]
Write a program that prints out all the elements of nums that are less than 75
Write a program that prints out all the elements of nums that are less than 75
Solution
Solution
Exercise #8
Exercise #8
nums = [86, 71, 62, 93, 54, 78, 93, 121, 104, 125, 89]
nums = [86, 71, 62, 93, 54, 78, 93, 121, 104, 125, 89]
Write a program that takes the elements in nums and converts them to letters or characters.
Write a program that takes the elements in nums and converts them to letters or characters.
Solution
Solution