Exemplo n.º 1
0
import hello as h
h.print_hello()
import hello

hello.print_hello()

#先に作成した(hello.py)から8_4.pyにimportした。
Exemplo n.º 3
0
from hello import print_hello
import ex25

print_hello()

ex25.break_words("sting like a bee")
ex25.print_first_and_last("sting like a bee")
ex25.print_first_word("sting like a bee")
ex25.print_last_word("sting like a bee")
ex25.sort_sentence("sting like a bee")
ex25.sort_words("sting like a bee")
Exemplo n.º 4
0
#File project.py will call function from hello.py

import hello #import hello.py as a module

hello.print_hello() #call the print_hello function defined in hello.py

Exemplo n.º 5
0
 def test_output(self):
     """Ensure program produces correct output"""
     f = io.StringIO()  # Create pseudo-file where output will be sent
     with contextlib.redirect_stdout(f):  # Redirect output
         hello.print_hello()
     self.assertEqual(f.getvalue(), 'Hello, world!' + os.linesep)
Exemplo n.º 6
0
import math
import random
import statistics
import keyword
import hello
import cubed

print(cubed.pot(3))

print(math.pow(2, 3))

print(random.randint(0, 100))

nums = [1, 5, 33, 12, 46, 33, 2]

print(statistics.fmean(nums))

print(statistics.mean(nums))
print(statistics.median(nums))
print(statistics.mode(nums))

print(keyword.iskeyword("for"))
print(keyword.iskeyword("footbal"))

print(hello.print_hello())
 def test_step1(self):
     with captured_output() as (out, err):
         hello.print_hello()
     # This can go inside or outside the `with` block
     output = out.getvalue().strip()
     self.assertEqual(output, "Hello World!")
Exemplo n.º 8
0

import hello

hello.print_hello()
Exemplo n.º 9
0
	print('Toggled')
	
	
>>> n = slicer.util.getNode('foto')
>>> a = slicer.util.array('foto')
>>> import numpy as np
>>> hist, bin_edges = np.histogram(a,255)
>>> hist
>>> value_array = np.zeros((255))
>>> value_array
>>> for x in range(0, 255):
...   value_array[x] = 1


>>> sys.path.append("C:\\Users\\Daniel\\Desktop\\SOFTWARE\\PID\\TD")
>>> import hell
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named hell
>>> import hello
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Users\Daniel\Desktop\SOFTWARE\PID\TD\hello.py", line 1
    def print_hello:
                   ^
SyntaxError: invalid syntax
>>> import hello
>>> hello.print_hello
<function print_hello at 0x000000000C837518>
>>> hello.print_hello()
Exemplo n.º 10
0
def hello():
	str = print_hello() # Вызов функции из модуля!
	return '%s' % str
Exemplo n.º 11
0
def home(request):
    context = {"context": print_hello()}
    return render(request, "home.html", context)