diff options
author | thing1 <thing1@seacrossedlovers.xyz> | 2025-03-03 08:07:43 +0000 |
---|---|---|
committer | thing1 <thing1@seacrossedlovers.xyz> | 2025-03-03 08:07:43 +0000 |
commit | 2ac42fa825d403e6285a58e08a62e6d549c86fa1 (patch) | |
tree | b6076a025c5ec1eabcac62217da0de4bfd098110 /comp/work/45 | |
parent | a14717c2f5fc893b504cdad7b9975d67af39d59a (diff) |
started elcectronics cw2
Diffstat (limited to 'comp/work/45')
-rw-r--r-- | comp/work/45/paircount.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/comp/work/45/paircount.py b/comp/work/45/paircount.py new file mode 100644 index 0000000..c9af5f0 --- /dev/null +++ b/comp/work/45/paircount.py @@ -0,0 +1,23 @@ +word = input("input your word: ") + ' ' + +pairs = "" + +for i in range(1, len(word)): + if word[i] == word[i-1]: + pairs += word[i] + print(word[i-1].upper(), end='') + else: + print(word[i-1], end='') +print("") + +done = "" +total = 0 + +for i in pairs: + if (i not in done): + done += i + total += pairs.count(i) + print(f"you have {pairs.count(i)} pairs of {i}") + +print("you have", total, "pairs total") + |