Example #1
0
    def test_greeting(self):
        """
        Test greeting.
        """
        # Should produce something if name isn't given or is blank.
        self.assertIsNotNone(greeting())
        self.assertIsNotNone(greeting(""))

        # Greeting should contain name.
        name = "foo"
        self.assertTrue(name in greeting(name))
Example #2
0
def commands(message):
    text = ' '.join(message.content[1:].lower().split())
    data = ''
    chat = []
    dat = msg = ''
    if text == 'hello':
        data += 'hello\t'
        dat, msg = hello.greeting(message)
    elif text == 'help':
        data += 'help \t'
        dat, msg = command.list(message)
    elif text == 'start':
        data += 'start\t'
        dat, msg = user.start(message)
    #### if the message is not on server and the user exist
    elif (not message.server) and user.exist(message.author):
        if user.gm(message.author):
            if text == 'list users':
                data += 'list \t'
                dat, msg = user.list(message)
            else:
                data += 'NfoundGM\t'
                dat, msg = error.commandNotFound(message)
        else:
            if command.exist(text):
                data += 'denied\t'
            else:
                data += 'not found\t'
            dat, msg = error.commandNotFound(message)
    else:
        if command.exist(text):
            data += 'denied\t'
        else:
            data += 'not found\t'
        dat, msg = error.commandNotFound(message)
    data += dat
    chat += msg
    return data, chat
Example #3
0
import hello

hello.greeting("Sakshi Das")
Example #4
0
import hello
hello.test()
hello._private_1('judy')
hello.greeting('ricky')
Example #5
0
def test_greeting():
    assert hello.greeting() == 'Hello, World!'
from hello import greeting

greeting("do something else")
Example #7
0
#Christine Logan
#9/11/2017
#CS 3240
#Lab 3
#helper.py

from hello import greeting

greeting("hello")
greeting("hola")
Example #8
0
from hello import greeting

greeting("unnecessary")
Example #9
0
from hello import greeting

greeting("doing something")
Example #10
0
def main():
    print(hello.greeting('Daniyar'))
    print('Hello')
Example #11
0
# mycompany
# ├─ __init__.py
# ├─ abc.py
# └─ xyz.py
#
# 引入了包以后,只要顶层的包名不与别人冲突,那所有模块都不会与别人冲突。现在,abc.py模块的名字就变成了mycompany.abc,类似的,xyz.py的模块名变成了mycompany.xyz。
#
# 请注意,每一个包目录下面都会有一个__init__.py的文件,这个文件是必须存在的,
# 否则,Python就把这个目录当成普通目录,而不是一个包。__init__.py可以是空文件,
# 也可以有Python代码,因为__init__.py本身就是一个模块,而它的模块名就是mycompany。

import hello
#hello.test()

hello.greeting('ffff')














Example #12
0
# here, we will demonstrate module and class
# first we need to import the file/class
import sys
# this will set our package location,
# IF ONLY the main.py not the same with our class
sys.path.insert(0, sys.path[0] + '/packages')

import hello

# then we can call it
hello.greeting()
print(hello.name)

# create an object of class
editor = hello.Editor('Jane Doe', 'Python Tutorial')
editor.editing()
Example #13
0
	if num == 1:
		return product
	return fact_iter(num - 1, num * product)





#x, y = move(100, 100, 60, math.pi / 6)
#r = move(100, 100, 60, math.pi / 6)
#print enroll('Jack', 'F', city = 'GZ')
#传入可变参数
#nums = [5,6,7]
#print cacl(*nums)

#传入关键字参数
#kw = {'city': 'GuangZhou', 'job': 'Doctor', 'address': 'sport chang'}
#person('Jack', 30, gender = 'F', **kw)

#参数组合
#args = (5, 8, 6, 8)
#kw = {'val': 100}
#func(1, 2, 4, 'a', 'b', x = 99)
#func(*args, **kw)

#调用递归函数
#print fact(6)

#调用模块函数
print hello.greeting('Lu')
Example #14
0
from hello import greeting
if __name__ == '__main__':
    print("The second message is: ", end="")
    greeting("hello2")
Example #15
0
"""
Show your greeting.
"""
from hello import greeting

print(greeting())
#challenge 8
import hello
name = input("Enter your name : ")
hello.greeting(name)
Example #17
0
import hello

print(hello.greeting('zzzh'))

hello.test()




Example #18
0
import hello

# 1. 类似__xxx__这样的变量是特殊变量,可以被直接引用,但是有特殊用途
# 2. 类似_xxx和__xxx这样的函数或变量就是非公开的(private),
# 不应该被直接引用
# 3. private函数和变量“不应该”被直接引用,而不是“不能”被直接引用,是因为Python并没有一种方法
# 可以完全限制访问private函数或变量
# print(hello.__name__)
# print(hello.__doc__)
# print(hello.__author__)

hello_name = hello.greeting(hello.get_name()[:3])
print(hello_name)
Example #19
0
# Sadiyah Faruk, sf2ne

from hello import greeting

greeting("Hello!")
Example #20
0
from hello import greeting

greeting("Hello")

Example #21
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date    : 2018-07-12 10:57:44
# @Author  : uhover ([email protected])
# @Link    : http://www.baidu.com/
# @Version : $Id$

from __future__ import division
import os
import sys
# import hello

# hello.test()

try:
    import hello as test
except ImportError:
    import test

test.test()
print test.__author__

print test.greeting('na')

print test._func1('name')

print sys.path

print 10 // 3