Views
解答例8
-
>>> x = '100' >>> x * 1.05 Traceback (most recent call last): File "
", line 1, in ? TypeError: can't multiply sequence by non-int >>> int(x) * 1.05 105.0 >>> -
#!/usr/bin/env python #-*- coding: utf-8 -*- # q2.py x = input('商品価格: '') print '消費税込みで', x*1.05
-
#!/usr/bin/env python #-*- coding: utf-8 -*- # q3.py import sys x = int(sys.argv[1]) print '商品価格は ', x print '消費税込みで', x*1.05