码迷,mamicode.com
首页 > 编程语言 > 详细

Beginner : Simple Python test

时间:2015-09-11 12:09:22      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

#!/usr/local/bin/python
# -*- coding: utf-8 -*-.
# line of utf-8 is for multi-language
# optional 4-spaces before line rule for Python.

import sys
sys.path.append("/homes/sli/pexpect-2.3/")
import pexpect
import time
import re
import os

print "Welcome to Python!"
def sum(x,y):
    sum = x+ y
    total = ‘the sum of {} and {} is {}.‘ .format(x,y,sum)
    print total
sum(2,3)
sum(-99,200)

[tool01 ~/my-test]$ ./sum-1.py
Welcome to Python!
the sum of 2 and 3 is 5.
the sum of -99 and 200 is 101.
[tool01 ~/my-test]$

Beginner : Simple Python test

标签:

原文地址:http://www.cnblogs.com/sli6000cn/p/4800351.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!