Skip to content

Instantly share code, notes, and snippets.

@chaitanya-lakkundi
Created February 6, 2021 10:27
Show Gist options
  • Save chaitanya-lakkundi/5bab51a6a2baa2d2b9112cfdf572d9af to your computer and use it in GitHub Desktop.
Save chaitanya-lakkundi/5bab51a6a2baa2d2b9112cfdf572d9af to your computer and use it in GitHub Desktop.
Pratyahara Demo
# Basic Pratyahara demo for students learning Python
msutra = ["अ", "इ", "उ", "ण्", "ऋ", "ऌ", "क्"]
# read pratyahara user input
pratyahara = input()
# entering अण्
startvarna = pratyahara[0]
endvarna = pratyahara[1:]
print(startvarna)
print(endvarna)
# search for startvarna in msutra
position = 0
startpos = 0
endpos = 0
for every_varna in msutra:
if every_varna == startvarna:
print("found the start varna")
startpos = position
if every_varna == endvarna:
print("found the end varna")
endpos = position
position = position + 1
print(startpos, endpos)
print(msutra[startpos:endpos])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment