From 809e1278c9b31467572de65bf992a7408efcc50b Mon Sep 17 00:00:00 2001 From: Kevin Bhingaradiya <37360392+kevinbhingaradiya@users.noreply.github.com> Date: Fri, 2 Oct 2020 11:58:26 +0530 Subject: [PATCH] Create String Basics.py Some Strings basics --- Basics/String Basics.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Basics/String Basics.py diff --git a/Basics/String Basics.py b/Basics/String Basics.py new file mode 100644 index 00000000..a6e2cc24 --- /dev/null +++ b/Basics/String Basics.py @@ -0,0 +1,26 @@ +#Get the character at position +a = "Hello, World!" +print(a[1]) + +#Slicing +b = "Hello, World!" +print(b[2:3]) + +#Negative Indexing +c = "Hello, World!" +print(c[-5:-2]) + +#String Length +d = "Hello, World!" +print(len(d)) + +#String Methods +e = " Hello, World! " +print(e.strip()) + +g = "Hello, World!" +print(g.lower()) + +h = "Hello, World!" +print(h.upper()) +