Post History
Python 3, 106 91 bytes Saved 15 bytes thanks to Moshi in the comments lambda a,b,c:[p for p in"+ - * // % **".split()if(p in'+-**'or b)and eval(f"{a}{p}{b}")==c] Try it online!
Answer
#2: Post edited
# [Python 3], 106 bytesThis uses `'//'` to denote integer division and `'**'` to denote exponentiation. Returns an empty list if none of the operations work.- <!-- language-all: lang-python -->
<pre><code>def f(a,b,c):	o=[]	for p in "+ - * // % **".split():		try:o+=[p]*eval(f"a{p}b==c")		except:0	return o</code></pre>[Try it online!][TIO-kugrxwdb]- [Python 3]: https://docs.python.org/3/
[TIO-kugrxwdb]: https://tio.run/##fZJLi4MwEMfP5lMMQjHatNrXPgQPhd2FhT0s9Fg8WJtsBavBxKWL@Nld4yMI@8ghh/n9/zOTyfAvecmzTdOcKQOGI3Iise0jIw@OITJYXgCHJANzDgtwwHVhBo5jLgVPE4mV0JDFl5/PgyMPHfoZpZiZUcXrUxDEpt1ieospl76HjILKssggbyQVMo4EFRBAhaA9GNYENgR2tg9wBGtuQUgGct@R9UBcd4IeCTwQ2HZIB1dEJRv1zkS@7shW1yAKq2siWm0J3LVpB9FiYt8R8MbEOuh1wdVYbVpOtdbSAc0mpDd500YWfTcQdpIaIfUfalA4Kj7KK82kIEBvnMaSntu5K1VBRZnKdogMO1pldyhhmgba1rvU4UWSScys9/3h8PzkA6u0v1af0ntrq09GU0F/el/2r2//eAmIS16mZzhRqMYOVEakluqXR6k105uxTCS9Cjw89M85oOYb "Python 3 – Try It Online"
- # [Python 3], <s>106</s> 91 bytes
- Saved 15 bytes thanks to [Moshi](https://codegolf.codidact.com/users/53196) in the [comments](https://codegolf.codidact.com/comments/thread/4781#comment-14226)
- <!-- language-all: lang-python -->
- lambda a,b,c:[p for p in"+ - * // % **".split()if(p in'+-**'or b)and eval(f"{a}{p}{b}")==c]
- [Try it online!][TIO-kuhwxmjm]
- [Python 3]: https://docs.python.org/3/
- [TIO-kuhwxmjm]: https://tio.run/##fZJJa8MwEIXv/hWPQPASOc7axeBDoC0UeijkmOYg21JjcBxjKaXF@Le7lhdh6KKDDvO9NzMaTf4lT5dsXXMEeKtTeg5jCkpCEvmHHPxSIEeSTWZw4cDzMIXjTOYiTxNp2Qm3FDVnruOYjTS0aRaDfdDU4pOSVmVelWE1sYMgOtaSCRlRwURTqTTQHAsrgjXB1vaBA8yZiSPpyW1LVj3xvBG6J7gj2LRIB5dEJRv0zki@aslG1yAKq2skWm4Ibpq0vcgd2bcEiyGxDi7a4HKoNi6nWmtoj6Yj0pkW40bcrhscW0llGDHjUIOyaPF@PbNMCgL2mbNIstj2W1XBxDWVzRC55WiV3aKEaxpoW@dSJy@STFrcfN3t948PPnip/ZX6lM5bmV0ylgr20/u0e375x0sgTpdrGiNkKIcOVEZDrdIvj2rWB3oz5olkZ2H1D/1zDkb9DQ "Python 3 – Try It Online"
#1: Initial revision
# [Python 3], 106 bytes This uses `'//'` to denote integer division and `'**'` to denote exponentiation. Returns an empty list if none of the operations work. <!-- language-all: lang-python --> <pre><code>def f(a,b,c): 	o=[] 	for p in "+ - * // % **".split(): 		try:o+=[p]*eval(f"a{p}b==c") 		except:0 	return o </code></pre> [Try it online!][TIO-kugrxwdb] [Python 3]: https://docs.python.org/3/ [TIO-kugrxwdb]: https://tio.run/##fZJLi4MwEMfP5lMMQjHatNrXPgQPhd2FhT0s9Fg8WJtsBavBxKWL@Nld4yMI@8ghh/n9/zOTyfAvecmzTdOcKQOGI3Iise0jIw@OITJYXgCHJANzDgtwwHVhBo5jLgVPE4mV0JDFl5/PgyMPHfoZpZiZUcXrUxDEpt1ieospl76HjILKssggbyQVMo4EFRBAhaA9GNYENgR2tg9wBGtuQUgGct@R9UBcd4IeCTwQ2HZIB1dEJRv1zkS@7shW1yAKq2siWm0J3LVpB9FiYt8R8MbEOuh1wdVYbVpOtdbSAc0mpDd500YWfTcQdpIaIfUfalA4Kj7KK82kIEBvnMaSntu5K1VBRZnKdogMO1pldyhhmgba1rvU4UWSScys9/3h8PzkA6u0v1af0ntrq09GU0F/el/2r2//eAmIS16mZzhRqMYOVEakluqXR6k105uxTCS9Cjw89M85oOYb "Python 3 – Try It Online"