chap07/sample1.py

サンプルコードのダウンロード

 1#!/usr/bin/env python
 2# -*- coding: utf-8 -*-
 3
 4n = 10
 5x = 3.14
 6
 7
 8def main():
 9    print('main() is called')
10    print('n = {}'.format(n))
11    print('x = {}'.format(x))
12
13
14if __name__ == '__main__':
15    print('This will be printed only if run as a script')
16    main()