/home_Python/note_/Histo/Histo2.py

INDEX Python.use(better)

》作業中です《

#! /usr/bin/env python
# coding: utf-8
## ----------------------------------------
##
## (C) Copyright 2000-2010, 小粒ちゃん《監修》小泉ひよ子とタマゴ倶楽部
##
## ----------------------------------------
"""
>>> s = str(license)
>>> s; len(s)
'Type license() to see the full license text'
43
>>> s; len(s)*"."
'Type license() to see the full license text'
'...........................................'

>>> s; scale_00(s)
'Type license() to see the full license text'
'...........................................'
>>> s; scale_01(len(s))
'Type license() to see the full license text'
'...........................................'
>>> s; scale_02(len(s))
'Type license() to see the full license text'
'...........................................'

>>> s; scale_03(len(s))
'Type license() to see the full license text'
'+....+....+....+....+....+....+....+....+..'
>>> s; scale_03a(len(s))
'Type license() to see the full license text'
'+.....+.....+.....+.....+.....+.....+.....+.....+...'

>>> s; scale_04(len(s))
'Type license() to see the full license text'
'0....+....1....+....2....+....3....+....4..'
>>> s.index("to")
15
>>> s; scale_04a(len(s))
'Type license() to see the full license text'
'0+....+....1+....+....2+....+....3+....+....4+..'

>>> s; scale_05(len(s))
'Type license() to see the full license text'
'0....+....1....+....2....+....3....+....4..'

>>> s; scale_06(len(s))
'Type license() to see the full license text'
'0....+....1....+....2....+....3....+....4..'

>>> s; scale_07(len(s))
'Type license() to see the full license text'
'0....+....1....+....2....+....3....+....4..'

>>> None
ex_fib: #1.0.07
"""
## ----------------------------------------
s = str(license)

def scale_00(s):
    return len(s)*"."

def scale_01(n):
    return n*"."

def scale_02(n):
    s = ""
    for e in range(n):
        s += "."
    return s

def scale_03(n):
    s = ""
    for e in range(n):
        if e%5==0:
            s += "+"
        else:
            s += "."
    return s

def scale_03a(n):
    s = ""
    for e in range(n):
        if e%5==0:
            s += "+"
        s += "."
    return s

def scale_04(n):
    s = ""
    for e in range(n):
        if not e%10:
            s += str(e//10)
        elif not e%5:
            s += "+"
        else:
            s += "."
    return s

def scale_04a(n):
    s = ""
    for e in range(n):
        if not e%10:
            s += str(e//10)
        if not e%5:
            s += "+"
        else:
            s += "."
    return s

def scale_05(n):
    s = ""
    for e in range(n):
        c = "."
        if not e%10:
            c = str(e//10)
        elif not e%5:
            c = "+"
        s += c
    return s

## ----------------------------------------
def scale_06(n):
    s = ""
    for e in range(n):
        s += ((".","+")[not e%5], str(e//10))[not e%10]
    return s

def scale_07(n):
    return "".join(
        [((".","+")[not e%5], str(e//10))[not e%10] for e in range(n)])

## ----------------------------------------
from time import ctime
from sys import argv, version

def inform():
    n = 60
    print("="*n)
    print("Version: %s"%version.split("\n")[0])
    print("Module : %s"%argv[0].split("/")[-1])
    print("Date   : %s"%ctime())
    print("="*n)

## ----------------------------------------
from doctest import testmod

if __name__=='__main__':
    inform()
    testmod()
##    print("... %s #1.0a"%__file__)

## ========================================

Last updated♪2010/03/10