Skip to content

Commit

Permalink
python course
Browse files Browse the repository at this point in the history
  • Loading branch information
Brar21 committed Jan 1, 2023
1 parent 07edc83 commit 4c82d85
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,9 @@
***Can you skip the index number in Python?***
- Answer is Yes. How! you are thinking about it...let understand with following example:
1. Example= "Varinder" --> skip "ar" and "nd"
2. simple print(Example[0:7:3]) --> you will get "Vie".
2. simple print(Example[0:7:3]) --> you will get "Vie".

# String functions in Python?
- Find length of string using len(). "len" is nothing just short form of length.
*syntax to write len function*
print(len(name_of_string))
13 changes: 13 additions & 0 deletions StringFunctions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#string Functions


#To find full length of String
'''
Find length of string using len().
"len" is nothing just short form of length.
'''
example="Find length of string using len()." #space is also counted in length
c= len(example)
print(c)
print(len(example)) # len() and you pass "example" as parameter in function.
# 34 is total length including "spaces".
2 changes: 1 addition & 1 deletion StringSlicing.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
print(string[-1]) #then -1 will automatically print last index "g"

Name="varinder" #skip index number you just need to provide three arguments
print(Name[0:7:3])
print(Name[0:7:3]) # "0" for start point "7" for till the end point and "3" is to skip chracters after print first chracter or letter o string.

0 comments on commit 4c82d85

Please sign in to comment.