## カウンタ

 COUNTER

## 日誌

Python Diary　>>　Article details

2019/08/22

| by kaizen

# 適用するルールによって意見は二分 「8÷2（2＋2）＝」の答えは？

https://news.livedoor.com/article/detail/16867682/?fbclid=IwAR0X6-jUxNWLWaE6RouXezm5mAsOPxK-amkEsp1k5ocln0bSiixUy_WDVbc

\$ python3
Python 3.6.1 |Continuum Analytics, Inc.| (default, May 11 2017, 13:04:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
>>> 8÷2(2＋2)
File "<stdin>", line 1
8÷2(2＋2)
^
SyntaxError: invalid character in identifier

>>> 8 ÷ 2 (2＋2)
File "<stdin>", line 1
8 ÷ 2 (2＋2)
^
SyntaxError: invalid character in identifier
>>> 8 / 2 ( 2 + 2 )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable
>>> 8 / 2 * ( 2 + 2 )
16.0
python2では

\$ python2.6
Python 2.6.9 (unknown, Feb  7 2017, 00:08:08)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
>>> 8÷2(2＋2)
File "<stdin>", line 1
8÷2(2＋2)
^
SyntaxError: invalid syntax
>>> 8 ÷ 2 ( 2 ＋ 2 )
File "<stdin>", line 1
8 ÷ 2 ( 2 ＋ 2 )
^
SyntaxError: invalid syntax
>>> 8 / 2 ( 2 ＋ 2 )
File "<stdin>", line 1
8 / 2 ( 2 ＋ 2 )
^
SyntaxError: invalid syntax

>>> 8 / 2 ( 2 + 2 )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable

>>> 8 / 2 * ( 2 + 2 )
16

 12:14 | Impressed! | Voted(0) | Comment(0)