import fibonacci_sequence as fib import hello_world as hlwd import slope as sl #Variables input_, loop = 0, 1 #Main loop while (loop == 1): print( '\n--------------------------------------------------\nAssignment 1:\nHello World:[1] Celsius/Fahrenheit Converter:[2]\nFurlong/Meter/Kilometer Converter:[3] Slope:[4]\nFibonacci Sequence:[5] Change Calculator:[6]\nQuit:[7]\n--------------------------------------------------' ) input_ = int(input('>>')) if (input_ == 1): print('Running Hello World:\n') hlwd.hello_world() elif (input_ == 2): print('Running Celsius/Fahrenheit Converter:\n') cov.cel_fah_con() elif (input_ == 3): print('Running Furlong/Meter/Kilometer Converter:\n') cov.fur_met_con() elif (input_ == 4): print('Running Slope:\n') sl.slope() elif (input_ == 5): print('Running Fibonacci Sequence:\n') fib.fib_seq() elif (input_ == 6): print('Running Change Calculator:\n') chg.change()
import hello_world if __name__ == "__main__": print(hello_world.hello_world())
#!/usr/bin/env python3 from name_function import get_formatted_name from hello_world import hello_world from good_bye import good_bye print("Enter 'q' at any time to quit.") while True: first = input("\nPlease give me a first name: ") if first == 'q': break last = input("Please give me a last name: ") if last == 'q': break formatted_name = get_formatted_name(first, last) print("\nNeatly formatted name: " + formatted_name + '.') hello_world_fun = hello_world() print(hello_world_fun) good_bye = good_bye() print(good_bye)
def test_hello_world(self): expected_result = "hello world" actual_result = hello_world() self.assertEqual(expected_result, actual_result)
import os import shutil from subprocess import check_call, call try: os.remove('hello_world.c') except WindowsError: pass try: os.remove('hello_world.pyd') except WindowsError: pass shutil.rmtree('build', ignore_errors=True) check_call(r'python setup.py build_ext -if'.split()) import hello_world import numpy as np import Cython print "*" * 80 print hello_world.hello_world(np.arange(10.)) print "Cython Version:", Cython.__version__ print "NumPy version:", np.__version__ print "*" * 80
def test_hello_world(self): self.assertEqual(hello_world("Toto"), "Hello Toto!")
def test_hello_world(): city = "Chicago" assert "Temperature" in hello_world.hello_world(city)
def test_hello_world(): if 'Message sent!' != hello_world( 'Test message!' ): raise StandardError( 'Failed test_hello_world()')
def test_hello_world(self): x = hello_world.hello_world() assert x == "Hello World!"
def hello_test(): hello_world.hello_world()
def test_hello_world(capsys): hello_world() out, _ = capsys.readouterr() assert out == "Hello World!\n"
def testHelloWorld(self): self.assertEqual(hello_world(), "Hello, World!")
def test_print(): assert hello_world() == "Hello World"
def test_hello_world(self): self.assertEqual(hello_world.hello_world(), 'Hello, World!')
def test_hello_world(self): """Will this return 'Hello World!'?""" hello_world_test = hello_world() self.assertEqual(hello_world_test, 'Hello World!')
def test_hello_world(): assert (hello_world(), 'Hello World!')
def test_hello_world(): assert hello_world("v1") == "Hello World v1"
def test_string(self): self.assertEqual(hello_world(), 'Hello World!')
def test_hello_world(self): value = hello_world() self.assertEqual(value, 'Hello World!')
def call(): return hello_world(request)
# Dependency Injection is where a piece of code allows the calling code to control its dependencies. import hello_world if __name__ == "__main__": hello_world.hello_world(output_function=print)
def test_hello(self): self.assertEqual(hello_world(), 'hello_world2')
import hello_world hello_world.hello_world() from hello_world import hello_world hello_world() from hello_world import hello_world as hw hw() import hello_world as hw hw.hello_world() from hello_world import * hello_world()
#!/usr/bin/env python # -*- coding: utf-8 -*- __date__ = '11 14, 2014 ' __author__ = 'mkfsn' import split_urls import hello_world URLS = 'http://google.pl http://youtube.com' print split_urls.do_split(URLS) hello_world.hello_world()
def test_hello_world(capsys): hello_world() out, _ = capsys.readouterr() assert out == "Hello World!\n:"
def test_hello_world(): '''Testing route at `/routes/helloworld.py`''' assert hello_world(None) == {'hello': 'world'}
import hello_world as hw hw.hello_world()
def test_hello_world(self): self.assertEqual(hello_world(), "Hello World")