From a0583d6c0e94a0ac4d68409d6b0ef585223d005a Mon Sep 17 00:00:00 2001 From: Pravesh <cb.en.u4cse16234@cb.students.amrita.edu> Date: Sun, 6 Jan 2019 15:09:32 +0530 Subject: [PATCH] lab2 --- CB.EN.U4CSE16234_lab2_q2.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 CB.EN.U4CSE16234_lab2_q2.py diff --git a/CB.EN.U4CSE16234_lab2_q2.py b/CB.EN.U4CSE16234_lab2_q2.py new file mode 100644 index 0000000..8719af3 --- /dev/null +++ b/CB.EN.U4CSE16234_lab2_q2.py @@ -0,0 +1,10 @@ +String str1=input("Enter a string") +dict = {} + for n in str1: + keys = dict.keys() + if n in keys: + dict[n] += 1 + else: + dict[n] = 1 +print(dict) + -- GitLab