diff --git a/15.py b/15.py new file mode 100644 index 0000000000000000000000000000000000000000..2389d665375a8fc40334dac49e706d4a734c7194 --- /dev/null +++ b/15.py @@ -0,0 +1,10 @@ +# Write a function solve that rotates an n x n matrix 90 degrees clockwise in-place. + +def solve(matrix): + for i in range(int(len(matrix))): + for j in range(i): + matrix[i][j], matrix[j][i] = matrix[j][i], matrix[i][j] + for list in matrix: + list.reverse() + return matrix + diff --git a/17.py b/17.py new file mode 100644 index 0000000000000000000000000000000000000000..296da98c4dc090b61a48ce2492370ab4bd599079 --- /dev/null +++ b/17.py @@ -0,0 +1,9 @@ +# Write a function solve that counts the number of vowels (a,e,i,o,u) in a string, ignoring case. + +def solve(string): + counter = 0 + vowels = ["a","e","i","o","u"] + for char in string.lower(): + if char in vowels: + counter += 1 + return counter