Pangrams are sentences constructed by using every letter of the alphabet at least once.
Steps:
Example : "The quick brown fox jumps over the lazy dog"Write a program to check given sentence to paragraph is pangrams or not.
Steps:
- create a list of all char a...z in small letters say list is ls.
- convert given string to small letters.
- Now chose char from given string one by one if that is found in ls then remove it from ls.
- Repeat step 3 until ls is empty of given string ends.
- if ls is empty after step 4 then it is pangrams else not pangrams.
Python Source code to check pangrams sentance
- sentc=raw_input('Input string to check pangrams :') #input given string
- sentc=sentc.lower() #convert to lower case
- charc='abcdefghijklmnopqrstuvwxyz'
- ls=[]
- for ch in charc:
- ls.append(ch)
- #ls contain all charcter a..z
- flag=False
- for ch in sentc:
- if ch in ls:
- ls.remove(ch)
- if len(ls)==0:
- flag=True
- break;
- if flag:
- print 'pangram'
- else:
- print 'not pangram'
I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Data Science with Python , kindly contact us http://www.maxmunus.com/contact
ReplyDeleteMaxMunus Offer World Class Virtual Instructor led training on TECHNOLOGY. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
For Demo Contact us.
Sangita Mohanty
MaxMunus
E-mail: sangita@maxmunus.com
Skype id: training_maxmunus
Ph:(0) 9738075708 / 080 - 41103383
http://www.maxmunus.com/