コード例 #1
0
def main():
    sentence = "All good things come to those who wait."
    words = ex25.break_words(sentence)
    print(words)
    sorted_words = ex25.sort_words(words)
    print(sorted_words)
    ex25.print_first_word(sorted_words)
    ex25.print_last_word(sorted_words)
    print(sorted_words)
    sorted_words = ex25.sort_sentence(sentence)
    print(sorted_words)
    ex25.print_first_and_last(sentence)
    ex25.print_first_and_last_sorted(sentence)
コード例 #2
0
import ex25
sentence = "All good things come to those who wait."
words = ex25.break_words(sentence)
print words

sorted_words = ex25.sort_words(words)
print sorted_words

ex25.print_first_word(words)

ex25.print_last_word(words)

sorted_words = ex25.sort_sentence(sentence)

print sorted_words

ex25.print_first_and_last(sentence)

ex25.print_first_and_last_sorted(sentence)

help(ex25)
コード例 #3
0
import ex25
sentence ="All good things come to those who wait."
words =ex25.break_words(sentence)
words
sorted_words=ex25.sort_words(words)
sorted_words
ex25.print_first_word(words)
ex25.print_last_word(words)
words
ex25.print_first_word(sorted_words)
ex25.print_last_word(sorted_words)
sorted_words
sorted_words=ex25.sort_sentence(sentence)
sorted_words
ex25.print_first_and_last(sentence)
ex25.print_first_and_last_sorted(sentence)
コード例 #4
0
ファイル: ex26.py プロジェクト: vastin/lpthw3

start_point = 10000
beans, jars, crates == secret_formula(start_point)

print "With a starting point of: %d" % start_point
print "We'd have %d jeans, %d jars, and %d crates." % (beans, jars, crates)

start_point = start_point / 10

print "We can also do that this way:"
print "We'd have %d beans, %d jars, and %d crabapples." % secret_formula(start_point)


sentence = "All god\tthings come to those who weight."

words = ex25.break_words(sentence)
sorted_words = ex25.sort_words(words)

print_first_word(words)
print_last_word(words)
ex25.print_first_word(sorted_words)
print_last_word(sorted_words)
sorted_words = ex25.sort_sentence(sentence)
print sorted_words

print_first_and_last(sentence)

print_first_and_last_sorted(sentence)

コード例 #5
0
#!/usr/bin/python

import ex25
sentence =  "hello world!"
words = ex25.break_words(sentence)
firstword = ex25.print_first_word(words)

print words
コード例 #6
0
import ex25
frase="solo se que nada se"
palabras = ex25.break_words(frase)
print palabras
ex25.print_first_word(palabras)
コード例 #7
0
ファイル: test.py プロジェクト: MitulIslam/LPTHW
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")
コード例 #8
0
ファイル: ex25-2.py プロジェクト: cdcd/Stupid-learning-python
import ex25

sentence = "All good things come to those who wait"
words = ex25.break_words(sentence)
print words

print "---------------------"
sorted_words = ex25.sort_words(words)
print sorted_words

print "---------------------"
print ex25.print_first_word(words)
print ex25.print_last_word(words)

print "---------------------"
print ex25.print_first_word(sorted_words)
print ex25.print_last_word(sorted_words)

print "---------------------"
sorted_words2 = ex25.sort_sentence(sentence)
print sorted_words2


print "---------------------"
print ex25.print_first_and_last(sentence)


print "---------------------"
print ex25.print_first_and_last_sorted(sentence)
コード例 #9
0
def print_first_and_last_sorted(sentence):
    """Sorts the words then prints the first and last one."""
    words = ex25.sort_sentence(sentence)
    ex25.print_first_word(words)
    ex25.print_last_word(words)
コード例 #10
0
ファイル: ex25n.py プロジェクト: xytnba/LP3THW
import ex25
sentence = "All good things come to those who wait."
#words = break_words(sentence)
words = ex25.break_words(sentence)
words  #
sorted_words = ex25.sort_words(words)
sorted_words  #
ex25.print_first_word(words)  #打印了个All
ex25.print_last_word(words)  #打印了个wait.
words  #
ex25.print_first_word(sorted_words)  #打印了个All。
ex25.print_last_word(sorted_words)  # 打印了个who
sorted_words  #
sorted_words = ex25.sort_sentence(sentence)
sorted_words  #
ex25.print_first_and_last(sentence)  #C: 打印第一个All和最后一个字wait。
ex25.print_first_and_last_sorted(sentence)  # D 打印第一个All和最后一个sorted的句子who。
print("-------- THE END ----------")
print("---------下面是采用了from ex25 import *")
from ex25 import *
sentence = "All good things come to those who wait."
#words = break_words(sentence)
words = break_words(sentence)
words  #
sorted_words = sort_words(words)
sorted_words  #
print_first_word(words)  #打印了个All
print_last_word(words)  #打印了个wait.
words  #
print_first_word(sorted_words)  #打印了个All。
print_last_word(sorted_words)  # 打印了个who
コード例 #11
0
#coding=utf-8
import ex25

sentence = "All good things come to those who wait."
words = ex25.break_words(sentence)
print words  #

sorted_words = ex25.sort_words(words)
print sorted_words  #
print "############s"
print ex25.print_first_word(words)  #
print "#########33"
print ex25.print_last_word(words)  #

#print wrods
print words

print ex25.print_first_word(sorted_words)

print ex25.print_last_word(sorted_words)

print sorted_words

sorted_words = ex25.sort_sentence(sentence)
print sorted_words

print ex25.print_first_and_last(sentence)
print "!" * 100
print ex25.print_first_and_last_sorted(sentence)
コード例 #12
0
ファイル: ex25_1.py プロジェクト: maquanhong/emacs
sentence = "All good things come to those who wait."

print 'words = ex25.break_words(sentence)'
words = ex25.break_words(sentence)
print 'words = ', words

print "----------"
print "sort words"
print "sorted_words = ex25.sort_words(words)"
sorted_words = ex25.sort_words(words)
print 'sorted_words = ', sorted_words

print "----------"
print "first word"
print "ex25.print_first_word(words)"
print "first word = ", ex25.print_first_word(words)

print "----------"
print "last word"
print "ex25.print_last_word(words)"
print "last word = ", ex25.print_last_word(words)

print "----------"
print "now words"
print "words = ", words

print "----------"
print "first sorted words"
print "ex25.print_first_word(sorted_words)"
print "first sorted words = ", ex25.print_first_word(sorted_words)
コード例 #13
0
#!/usr/bin/python

import ex25

sentence = "hello world!"
words = ex25.break_words(sentence)
firstword = ex25.print_first_word(words)

print words
コード例 #14
0
ファイル: ex25_1.py プロジェクト: maquanhong/emacs
print 'words = ex25.break_words(sentence)'
words = ex25.break_words(sentence)
print 'words = ', words


print "----------"
print "sort words"
print "sorted_words = ex25.sort_words(words)"
sorted_words = ex25.sort_words(words)
print 'sorted_words = ', sorted_words

print "----------"
print "first word"
print "ex25.print_first_word(words)"
print "first word = ", ex25.print_first_word(words)

print "----------"
print "last word"
print "ex25.print_last_word(words)"
print "last word = ", ex25.print_last_word(words)

print "----------"
print "now words"
print "words = ", words

print "----------"
print "first sorted words"
print "ex25.print_first_word(sorted_words)"
print "first sorted words = ", ex25.print_first_word(sorted_words)
コード例 #15
0
(venv) D:\python\笨办法学python>python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ex25
>>> sentence = "All good things come to those who wait"
>>> words = ex25.brek_words(sentence)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'ex25' has no attribute 'brek_words'
>>> words = ex25.break_words(sentence)
>>> words
['All', 'good', 'things', 'come', 'to', 'those', 'who', 'wait']
>>> sorted_words = ex25.sort_words(words)
>>> sorted_words
['All', 'come', 'good', 'things', 'those', 'to', 'wait', 'who']
>>> ex25.print_first_word(words)
All
>>> ex25.print_last_word(words)
wait
>>> wrods
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'wrods' is not defined
>>> words
['good', 'things', 'come', 'to', 'those', 'who']
>>> ex25.print_last_word(sortes_words)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'sortes_words' is not defined
>>> sorted_words
['All', 'come', 'good', 'things', 'those', 'to', 'wait', 'who']
コード例 #16
0
ファイル: prac.py プロジェクト: glennrzhang/glennscode
import ex25

ex25.print_first_word("Lol you got trolled")

ex25.sort_words(
    "lol lol lol you lol lol lol got lol lol lol trolled lol lol lol ! lol lol lol"
)