PDF Google Drive Downloader v1.1


Report a problem

Content text String Manipulation - Part 02.pdf

# -*- coding: utf-8 -*- """StringManipulation.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1Ts9kl_GB8DyrTIj4hh3SibfOM3xSr500 """ name = 'String Manipulation' for ch in name: print(ch,'-',end = ' ') #Reverse a string name = 'Let us learn python' length = len(name) #Return an integer value for i in range(-1,-length-1,-1): print(name[i],end = '') #String concatenation name1 = "Good" name2 = '2' print(name1+name2) #You cannot add "Good" + 2 or 2 + "Morning" ---- Error as well as invalid #String concatenation name1 = "123" name2 = "456" print(name1+name2) name1 = 123 name2 = 456 print(name1+name2) #String Replication name1 = '''Good morning''' times = '''3''' print(name1*times) #You cannot multiple strings --- "abc" * "bcd" ---- Error as well as in valid #Membership operators --- in and not in if "Su" not in "sundar": print('Present') else: print('Absent') a = "Su" in "Sundar" print(a)
#Comparison Operators Ans1 = "a" == "a" print(Ans1) Ans2 = "abc" == "abc" print(Ans2) Ans3 = "a" != "abc" print(Ans3) Ans4 = "Abc" != "abc" print(Ans4) Ans5 = "ABC" == "abc" print(Ans5) #ord() - gives the unicode value of a character print(ord('-')) print(ord('m')) #a-z 97-122 #A-Z 65-90 #0-9 48-57 #chr() - return the character of the unicode value print(chr(67)) print(chr(64)) #Before capital A print(chr(91)) #After capital Z print(chr(96)) #Before small a print(chr(123)) #After small z print(chr(47)) #Before digit 0 print(chr(58)) #After digit 9 #Printing Code Char = "*" Pattern = "" for i in range(5): Pattern+=Char #* print(Pattern) name1='' name2='Sundar' name2+=name1 print(name2) Char = '*' for i in range(5): for j in range(i+1): print(Char,end='') #Line 3 and 4 is responsible for printing an entire row print() #Slicing Str = "PAYATTENTION"

Related document

x
Report download errors
Report content



Download file quality is faulty:
Full name:
Email:
Comment
If you encounter an error, problem, .. or have any questions during the download process, please leave a comment below. Thank you.