Skip to content.

kagome.lab.tkikuchi.net

Sections
Personal tools
You are here: Home » Members » tkikuchi's Home » 授業 » 専門コア情報処理演習(2006) » 解答例8
Views

解答例8

Document Actions
  1. >>> 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
    >>>
    
  2. #!/usr/bin/env python
    #-*- coding: utf-8 -*-
    # q2.py
    x = input('商品価格: '')
    print '消費税込みで', x*1.05
    
  3. #!/usr/bin/env python
    #-*- coding: utf-8 -*-
    # q3.py
    import sys
    x = int(sys.argv[1])
    print '商品価格は  ', x
    print '消費税込みで', x*1.05
    
Created by tkikuchi
Last modified 2006-12-17 10:26
 

Powered by Plone

This site conforms to the following standards: