From e0a63e5efa72953f46da4dbd30b099cec3d97259 Mon Sep 17 00:00:00 2001 From: HeYPoonam <115446295+HeYPoonam@users.noreply.github.com> Date: Tue, 11 Oct 2022 16:55:13 +0530 Subject: [PATCH] Create check-character-occurance-in-string.py --- .../check-character-occurance-in-string.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Lesson 6 - String Manipulation/check-character-occurance-in-string.py diff --git a/Lesson 6 - String Manipulation/check-character-occurance-in-string.py b/Lesson 6 - String Manipulation/check-character-occurance-in-string.py new file mode 100644 index 0000000..e5d3c76 --- /dev/null +++ b/Lesson 6 - String Manipulation/check-character-occurance-in-string.py @@ -0,0 +1,10 @@ +count = 0 + +my_string = input("Enter string ") +my_char = input("Enter character ") + +for i in my_string: + if i == my_char: + count += 1 + +print(my_char +" is present in "+ my_string +" " + str(count)+" times")