Beispiel #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)
Beispiel #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)
Beispiel #4
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)
print(ex25.print_first_word(words))
print(ex25.print_last_word(words))
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(ex25.print_first_and_last_sorted(sentence))
# help(ex25)
help(ex25.break_words)

# import ex25
# sentence = "All good\tthings come to those who wait."

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

# print_first_word(words)
# print_last_word(words)
# print_first_word(sorted_words)
# print_last_word(sorted_words)
# sorted_words = ex25.sort_sentence(sentence)
# print (sorted_words)
Beispiel #5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Exercise 25 : Even More Practice (Main Program)

@author Hank Wang <*****@*****.**>
@version 20160423
"""
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(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)
Beispiel #6
0
#coding: utf-8
import ex25 #不能是25.py
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 ex25.print_first_word(words)
print ex25.print_last_word(words)

print words

Beispiel #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")
Beispiel #8
0
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)
Beispiel #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)
Beispiel #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
Beispiel #11
0
import ex25
sentence = "The quick brown fox jumps over the lazy dog."
words = ex25.break_words(sentence)
print ex25.break_words(sentence)
print "\n"
print ex25.sort_words(words)
print "\n"
print ex25.print_first_word(words)
print "\n"
print ex25.print_last_word(words)
print "\n"
print ex25.sort_sentence(sentence)
print "\n"
print ex25.print_first_and_last(sentence)
print "\n"
print ex25.print_first_and_last_sorted(sentence)

Beispiel #12
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)
Beispiel #13
0
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)

print "----------"
print "last sorted words"
print "ex25.print_last_word(sorted_words)"
print "last sorted words = ", ex25.print_last_word(sorted_words)
Beispiel #14
0
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)

print "----------"
print "last sorted words"
print "ex25.print_last_word(sorted_words)"
print "last sorted words = ", ex25.print_last_word(sorted_words)
Beispiel #15
0
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']
>>> sorted_words = ex25.sort_sentence(sentence)
>>> sorted_words
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(ex25.print_first_word(words))
print(ex25.print_last_word(words))
print(words)
print(ex25.print_first_word(sorted_words))
print(sorted_words)
sorted_words = ex25.sort_sentence(sentence)
print(sorted_words)
print(ex25.print_first_and_last(sentence))