示例#1
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 good things come to those who wait."

words = ex25.break_words(sentence)
print(words)
sorted_words = ex25.sort_words(words)
print(sorted_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)

print_first_and_last(sentence)

print_first_and_last_sorted(sentence)

示例#2
0
from Projects import ex25
# -*- coding: utf-8 -*-

sentence = "All good things come to those who wait."#példamondat
words = ex25.break_words(sentence)                  #példamondat szavakra tagolása
print(words)

sorted_words = ex25.sort_words(words)               #tagolt szavak abc rendbe sorolása
print(sorted_words)

ex25.print_first_word(words)                        #első szó kiírása
ex25.print_last_word(words)                         #utolsó szó kiírása


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)