From 3546b02d843443f77d4a8c707a9d8eac15e3393d Mon Sep 17 00:00:00 2001 From: PrayagG Date: Sun, 31 Oct 2021 14:56:36 +0530 Subject: [PATCH] Create PythonReplaceString --- PythonReplaceString | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 PythonReplaceString diff --git a/PythonReplaceString b/PythonReplaceString new file mode 100644 index 00000000..dd8780f6 --- /dev/null +++ b/PythonReplaceString @@ -0,0 +1,9 @@ +string = "geeks for geeks geeks geeks geeks" + +# Prints the string by replacing +# e by a +print(string.replace("e", "a")) + +# Prints the string by replacing only +# 3 occurrence of ek by a +print(string.replace("ek", "a", 3))