Post History
In this challenge, add 2 integers, but if both the integers are 2, output 5. Shortest code in each language wins! Example ungolfed program in Python 3.x def add(x, y): if x == 2 and y == 2: ...
#3: Post edited
Make $2 + 2 = 5$
In this challenge, make a program that adds 2 integers, preferably on a function, and if the statement is `2 + 2`, return or print `5`. Shortest program in each language wins!- # Example ungolfed program in [Python 3.x]
- <!-- language-all: lang-python -->
- <pre><code>def add(x, y):
- 	if x == 2 and y == 2:
- 		return 5
- 	else:
- 		return x + y
- </code></pre>
- [Try it online!][TIO-ksu80pvu]
- [Python 3.x]: https://docs.python.org/3/
- [TIO-ksu80pvu]: https://tio.run/##Vcy9CoAgGEbhWa/iHf3ISWkJvBhBJSFMzECv3n6m2g7PcHKv6570GM4HWOdEk@i0cBYDGoyBgk0O/c2bWfH1LAkzZ347/EcaJnTOc4mpiuekJBTRHzTRGBc "Python 3 – Try It Online"
- In this challenge, add 2 integers, but if both the integers are `2`, output `5`. Shortest code in each language wins!
- # Example ungolfed program in [Python 3.x]
- <!-- language-all: lang-python -->
- <pre><code>def add(x, y):
- 	if x == 2 and y == 2:
- 		return 5
- 	else:
- 		return x + y
- </code></pre>
- [Try it online!][TIO-ksu80pvu]
- [Python 3.x]: https://docs.python.org/3/
- [TIO-ksu80pvu]: https://tio.run/##Vcy9CoAgGEbhWa/iHf3ISWkJvBhBJSFMzECv3n6m2g7PcHKv6570GM4HWOdEk@i0cBYDGoyBgk0O/c2bWfH1LAkzZ347/EcaJnTOc4mpiuekJBTRHzTRGBc "Python 3 – Try It Online"
#2: Post edited
In this challenge, make a program that adds 2 integers, preferably on a function, and if the statement is `2 + 2`, return `5`. Shortest program in each language wins!- # Example ungolfed program in [Python 3.x]
- <!-- language-all: lang-python -->
- <pre><code>def add(x, y):
- 	if x == 2 and y == 2:
- 		return 5
- 	else:
- 		return x + y
- </code></pre>
- [Try it online!][TIO-ksu80pvu]
- [Python 3.x]: https://docs.python.org/3/
- [TIO-ksu80pvu]: https://tio.run/##Vcy9CoAgGEbhWa/iHf3ISWkJvBhBJSFMzECv3n6m2g7PcHKv6570GM4HWOdEk@i0cBYDGoyBgk0O/c2bWfH1LAkzZ347/EcaJnTOc4mpiuekJBTRHzTRGBc "Python 3 – Try It Online"
- In this challenge, make a program that adds 2 integers, preferably on a function, and if the statement is `2 + 2`, return or print `5`. Shortest program in each language wins!
- # Example ungolfed program in [Python 3.x]
- <!-- language-all: lang-python -->
- <pre><code>def add(x, y):
- 	if x == 2 and y == 2:
- 		return 5
- 	else:
- 		return x + y
- </code></pre>
- [Try it online!][TIO-ksu80pvu]
- [Python 3.x]: https://docs.python.org/3/
- [TIO-ksu80pvu]: https://tio.run/##Vcy9CoAgGEbhWa/iHf3ISWkJvBhBJSFMzECv3n6m2g7PcHKv6570GM4HWOdEk@i0cBYDGoyBgk0O/c2bWfH1LAkzZ347/EcaJnTOc4mpiuekJBTRHzTRGBc "Python 3 – Try It Online"
#1: Initial revision
Make $2 + 2 = 5$
In this challenge, make a program that adds 2 integers, preferably on a function, and if the statement is `2 + 2`, return `5`. Shortest program in each language wins! # Example ungolfed program in [Python 3.x] <!-- language-all: lang-python --> <pre><code>def add(x, y): 	if x == 2 and y == 2: 		return 5 	else: 		return x + y </code></pre> [Try it online!][TIO-ksu80pvu] [Python 3.x]: https://docs.python.org/3/ [TIO-ksu80pvu]: https://tio.run/##Vcy9CoAgGEbhWa/iHf3ISWkJvBhBJSFMzECv3n6m2g7PcHKv6570GM4HWOdEk@i0cBYDGoyBgk0O/c2bWfH1LAkzZ347/EcaJnTOc4mpiuekJBTRHzTRGBc "Python 3 – Try It Online"