Skip to content

Commit

Permalink
Auto stash before merge of "main" and "origin/main"
Browse files Browse the repository at this point in the history
  • Loading branch information
italojsoliveira committed Dec 15, 2023
1 parent 5378435 commit 16a999d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,12 @@ Write a program that receives an amount in the US dollar from the user and outpu

#### Exercise 9

Write a program which counts and print the numbers of each character in a string input given by the user. The outcome should be a dictionary. For example, for the input 'abcdefgabc', the output should be {'a':2, 'c':2, 'b':2, 'e':1, 'd':1, 'g':1, 'f':1}

#### Exercise 10





---
13 changes: 13 additions & 0 deletions set_1/ex9.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Write a program which counts and print the numbers of each character in a string input given by the user.
# The outcome should be a dictionary.
# For example, for the input 'abcdefgabc', the output should be {'a':2, 'c':2, 'b':2, 'e':1, 'd':1, 'g':1, 'f':1}

user_input = input('Enter a string: ')

count = dict()

for string in user_input:

count[string] = count.get(string, 0) + 1

print(count)

0 comments on commit 16a999d

Please sign in to comment.