Simple Python calculator

Submit

Your name:
File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

Problem

You must create a simple calculator console app in Python 2. The calculator should be only 1 line of code, though, and should not contain any semicolons. The calculator should add, subtract, multiply, divide, and raise to powers. Floating point inputs must be accepted and answers must be accurate to at least 1/1000. Order of operations should be parsed properly and parentheses can be used in inputs.

Since this is code golf, the shortest code wins.

Options

exec is denied

rejudge feature is enabled

now post-mortem time, all source codes will be revealed

Sample input:_

(2+3)*4^1.5

Sample output:

30

Sample input:_

1+1

Sample output:

2

Sample input:_

2+3*4^1.5

Sample output:

36

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1mender120.03362016/12/19 23:52:000B / 9B / 2B
2mitchs140.03972016/12/18 04:33:372B / 6B / 6B
3%20140.03962016/12/18 08:07:112B / 6B / 6B
4rotary-o150.04862016/12/19 01:42:270B / 11B / 3B

Ruby2 _

RankUserSizeTimeDateStatistics
1rotary-o180.19742016/12/17 23:32:270B / 13B / 5B
2siman210.20472016/12/19 10:39:130B / 13B / 7B
3%20230.23332016/12/17 02:26:060B / 11B / 11B
4hogeover30250.19692016/12/17 01:19:120B / 15B / 9B

Perl _

RankUserSizeTimeDateStatistics
1test1160.03232016/12/18 05:37:170B / ?B / ?B
2tanon190.03932016/12/18 01:03:110B / 10B / 9B
3teebee190.04632016/12/18 10:57:110B / 10B / 9B
4%20260.04022016/12/17 02:27:290B / 14B / 12B

Python _

RankUserSizeTimeDateStatistics
1mender310.11992016/12/20 00:07:180B / 22B / 8B
2Da350.10492016/12/17 06:31:480B / ?B / ?B

Python3 _

RankUserSizeTimeDateStatistics
1mender280.18892016/12/20 00:07:020B / 19B / 9B

JavaScript _

RankUserSizeTimeDateStatistics
1FizzyTea330.05712016/12/19 08:35:280B / 19B / 14B

PARI/GP _

RankUserSizeTimeDateStatistics
1pooq340.05252021/05/11 14:35:400B / ?B / ?B

Perl6 _

RankUserSizeTimeDateStatistics
1tanon261.50402016/12/18 12:05:550B / 17B / 7B

J _

RankUserSizeTimeDateStatistics
1pooq240.07422021/03/18 08:32:560B / 12B / 9B

Haskell _

RankUserSizeTimeDateStatistics
1henkma390.03462016/12/19 22:54:350B / 30B / 8B
2yuki480.03842016/12/19 12:01:470B / 27B / 15B

sed _

RankUserSizeTimeDateStatistics
1%20160.03152016/12/17 01:54:020B / 9B / 5B
2mitchs160.03452016/12/18 04:08:490B / 9B / 5B

jq _

RankUserSizeTimeDateStatistics
1pooq210.03432018/01/30 10:33:350B / ?B / ?B

Befunge _

RankUserSizeTimeDateStatistics
1%20100.03172016/12/18 08:04:042B / 3B / 5B
2test1100.03212016/12/18 22:07:192B / ?B / ?B
3test1(nobin)120.03502016/12/18 22:08:150B / 2B / 10B

Labyrinth _

RankUserSizeTimeDateStatistics
1mender90.26682016/12/19 23:57:420B / 4B / 5B

GolfScript _

RankUserSizeTimeDateStatistics
1mender80.05162016/12/19 23:47:460B / 2B / 6B
2mitchs100.05602016/12/18 04:23:382B / 2B / 6B
3lynn110.04642016/12/17 03:18:062B / 3B / 6B

gs2 _

RankUserSizeTimeDateStatistics
1mitchs70.23532016/12/18 01:30:073B / 3B / 1B
2whio110.24862016/12/17 06:46:305B / 4B / 2B
3whio90.26352016/12/20 02:45:585B / 2B / 2B

Burlesque _

RankUserSizeTimeDateStatistics
1Hendrik140.07352016/12/17 05:19:340B / 6B / 8B

FerNANDo _

RankUserSizeTimeDateStatistics
1test1510.14272016/12/17 06:10:010B / ?B / ?B

Vim _

RankUserSizeTimeDateStatistics
1FizzyTea170.07332016/12/19 09:02:062B / 12B / 3B

Scala _

RankUserSizeTimeDateStatistics
1Hendrik245.53922016/12/18 00:41:010B / 18B / 6B
2rotary-o246.48992016/12/18 11:39:070B / 19B / 5B

Language Ranking_

RankLangUserSizeScore
1gs2mitchs710000
2GolfScriptmender88750
3Labyrinthmender97777
4Befunge%20107000
5Rubymender125833
6BurlesqueHendrik145000
7sed%20164375
8Perltest1164375
9VimFizzyTea174117
10Ruby2rotary-o183888
11jqpooq213333
12ScalaHendrik242916
13Jpooq242916
14Perl6tanon262692
15Python3mender282500
16Pythonmender312258
17JavaScriptFizzyTea332121
18PARI/GPpooq342058
19Haskellhenkma391794
20FerNANDotest1511372

return to the top page