Skip to content

Commit 254f67f

Browse files
committed
reorganized, added vowell counter
1 parent e0b5f73 commit 254f67f

File tree

16 files changed

+34
-8
lines changed

16 files changed

+34
-8
lines changed

README.md

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
1-
## Python Developer Test
1+
# Python Developer Test
22

33
A simple test to show that a web developer knows how to use basic tools and understands the basics of the Python language.
44

55
> Make sure your code is compatible with the [latest versions](https://www.python.org/downloads/) of Python 2 and 3. Thanks!
66
7-
### Tests
7+
## Tests
88

9-
Make sure to fork this repository and submit a pull request with the requested tasks completed.
9+
Please fork this repository, clone it down, and then when you finish a test commit/push your code to Github and submit a pull request.
1010

11-
#### Part 1: Python Basics
11+
Write unit tests to prove that the function works.
12+
13+
### Part 1: Python Basics
14+
15+
## String Reverse
1216

1317
1. Create a function called `reverse()` that reverses a string.
14-
1. Write unit tests to prove that the function works.
15-
1. Add your solution (both scripts) to the "part1" folder in a new folder called "reverse_yourlastname".
16-
1. Commit/push to Github and submit a pull request.
18+
1. Add your solution to the "part1/reverse-string" folder in a new folder called "reverse_yourlastname".
19+
20+
#### Count Vowels
21+
22+
1. Create a function called `vowel_counter()` that takes a string as an argument and returns the sum of each vowel found.
23+
1. Add your solution to the "part1/vowel-counter" folder in a new folder called "counter_yourlastname".
1724

1825
### Part 2: Web Development with Flask
1926

@@ -30,4 +37,4 @@ Make sure to fork this repository and submit a pull request with the requested t
3037
1. Add Django Test
3138
1. Add Pyramid Test
3239
1. Add web2py Test
33-
1. Create web app
40+
1. Create web app
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def vowel_counter(string):
2+
vowels = {'a': 0, 'e': 0, 'i': 0, 'o': 0, 'u': 0}
3+
for letter in string:
4+
if letter in vowels:
5+
vowels[letter] += 1
6+
return vowels
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from count_vowels import vowel_counter
2+
3+
4+
print(vowel_counter("happy") ==
5+
{'a': 1, 'e': 0, 'i': 0, 'o': 0, 'u': 0}) # true
6+
print(vowel_counter("birthday") ==
7+
{'a': 1, 'e': 0, 'i': 1, 'o': 0, 'u': 0}) # true
8+
print(vowel_counter("apathetic") ==
9+
{'a': 2, 'e': 1, 'i': 1, 'o': 0, 'u': 0}) # true
10+
print(vowel_counter("you") ==
11+
{'a': 1, 'e': 0, 'i': 0, 'o': 1, 'u': 1}) # false
12+
print(vowel_counter("you") ==
13+
{'a': 0, 'e': 0, 'i': 0, 'o': 1, 'u': 1}) # false

0 commit comments

Comments
 (0)