summaryrefslogtreecommitdiff
path: root/comp
diff options
context:
space:
mode:
Diffstat (limited to 'comp')
-rw-r--r--comp/work/45/paircount.py23
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")
+