Exemple #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)
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)
Exemple #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)
Exemple #4
0

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)

#!/usr/bin/python

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

print words
import ex25
frase="solo se que nada se"
palabras = ex25.break_words(frase)
print palabras
ex25.print_first_word(palabras)
Exemple #7
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")
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)
Exemple #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)
Exemple #10
0
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
Exemple #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)
Exemple #12
0
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)
Exemple #13
0
#!/usr/bin/python

import ex25

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

print words
Exemple #14
0
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)
Exemple #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']
Exemple #16
0
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"
)