First time here? Check out the FAQ!

Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If v is in R then you can use e.g. the condition v[:3] == '$a_' to check that the first three characters in v are $a_.

sage: [v for v in R if v[:3] == '$a_']
['$a_{3}$', '$a_{5}$']
click to hide/show revision 2
No.2 Revision

If v is in R then you can use e.g. the condition v[:3] == '$a_' to check that the first three characters in v are $a_.

sage: [v for v in R if v[:3] == '$a_']
['$a_{3}$', '$a_{5}$']
sage: for v in R:
....:     if v[:3] == '$a_':
....:         print(v)
....:                                                                                                                                                                                         
$a_{3}$
$a_{5}$