The user is prompted to enter a grammar with a two letter key followed by uppercase variable names. The key and variables are separated into a dictionary as the first grammar. Each uppercase variable is then prompted for a value and replaced in the original grammar string to create a second grammar dictionary with the variables substituted.
The user is prompted to enter a grammar with a two letter key followed by uppercase variable names. The key and variables are separated into a dictionary as the first grammar. Each uppercase variable is then prompted for a value and replaced in the original grammar string to create a second grammar dictionary with the variables substituted.
The user is prompted to enter a grammar with a two letter key followed by uppercase variable names. The key and variables are separated into a dictionary as the first grammar. Each uppercase variable is then prompted for a value and replaced in the original grammar string to create a second grammar dictionary with the variables substituted.
v=g[2:] key=g[:2] grammar = {key:v} print("First grammar is : " + str(grammar)) a = re.findall("[A-Z]", v) ##d=re.search("[A-Z]",v) ##print(d.start()) value1='' if (len(a)!=0): for i in range(len(a)): c=a[i] value1=input(("Enter the value of " + c + " : "))
v=v[:-1] value2=v+value1 grammar2={key:value2} print("Second grammar is : " + str(grammar2))