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)
Beispiel #2
0
def main():
    """Exercise 26: Congratulations, Take a Test!"""
    print "Let's practice everything."
    print 'You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs.'

    poem = """
    \tThe lovely world
    with logic so firmly planted
    cannot discern \n the needs of love
    nor comprehend passion from intuition
    and requires an explantion
    \n\t\twhere there is none.
    """


    print "--------------"
    print poem
    print "--------------"

    five = 10 - 2 + 3 - 5
    print "This should be five: %s" % five

    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)
    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)
Beispiel #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")
Beispiel #4
0
from ex25a import adder
import ex25

print(adder(3, 4))
line = "this is new line not the previous one"
words = ex25.break_words(line)
print(words)
print(ex25.sort_words(words))
ex25.print_first_word(words)
ex25.print_last_word(words)
print(ex25.sort_sentence(line))
ex25.print_first_and_last(line)
ex25.print_first_and_last_sorted(line)
Beispiel #5
0
    crates = jars / 100
    return jelly_beans, jars, crates


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

print "With a starting point of: %d" % start_point
print "We'd have %d beans, %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 crates." % secret_formula(start_point)


sentence = "All good things come to those who wait."

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

ex25.print_first_word(words)
ex25.print_last_word(words)
ex25.print_first_word(sorted_words)
ex25.print_last_word(sorted_words)
ex25.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
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) #ex25에서 break_words란 함수를 가져와 사용한다는 의미
print(words)
sorted_words = ex25.sort_words(words)
print(sorted_words)

ex25.print_first_word(words)
ex25.print_last_word(words)
ex25.print_first_word(sorted_words)
ex25.print_last_word(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 #7
0
import ex25

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

Beispiel #8
0
import ex25 #imports all methods written in this file
from ex25 import break_words #imports specific method from this file
from ex25 import * #imports all functions from the method

sentence = "All good things come to those who wait"
words = break_words(sentence)  #refers to method within the file
print words

sorted_words = ex25.sort_words(words)
print sorted_words

ex25.print_first_word(words)

ex25.print_last_word(words)

print words #after words have been popped off the array they are no longer there

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 #10
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) #Point and not pont
 
sentence = "All good things come to those who wait." #Editet here.
 
words = ex25.break_words(sentence) #Hat to write at the topp import ex25
sorted_words = ex25.sort_words(words)
 
print_first_word(words)
print_last_word(words)
print_first_word(sorted_words) #editet here.
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)
 
 
print "Test \n" + "Idiot" #added idiot here.
import ex25 as e

sentence = "All good things come to those who wait."
words = e.break_words(sentence)
print words
Beispiel #12
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 beans, %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 crates." % secret_formula(
    START_POINT)


SENTENCE = "All good things come to those who wait."

import ex25

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

print_first_and_last(SENTENCE)

print_first_and_last_sorted(SENTENCE)
Beispiel #13
0
def print_first_and_last(sentence):
    """Prints the first and last words of the sentence."""
    words = break_words(sentence)
    print_first_word(words)
    print_last_word(words)
Beispiel #14
0
def sort_sentence(sentence):
    """Takes in a full sentence and returns the sorted words."""
    words = break_words(sentence)
    return sort_words(words)
Beispiel #15
0
start_point = 10000
#beans, jars, crates == secret_formula(start-point)
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_pont) 
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) #此处需要引用到ex25.py里面的方法,所以需要在开头的时候把ex25.py里面的函数导入
sorted_words = ex25.sort_words(words)#导入方式为:import ex25

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

#print_irst_and_last(sentence) NameError: name 'print_irst_and_last' is not defined
print_first_and_last(sentence)

   #print_first_a_last_sorted(senence)
import ex25
frase="solo se que nada se"
palabras = ex25.break_words(frase)
print palabras
ex25.print_first_word(palabras)
# -*- coding: utf-8 -*-
"""
Created by AnonymouS at 7/8/2019
"""

from ex25 import break_words

print(break_words("A test for importing my own modules"))
Beispiel #18
0
    jelly_beans = started * 500
    jars = jelly_beans / 1000
    crates = jars / 100
    return jelly_beans, jars, crates


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

print "With a starting point of: %d" % start_point
print "We'd have %d beans, %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 crates." % secret_formula(start_point)


sentence = "All good things come to those who wait."

import ex25
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)
print ex25.sort_sentence(sentence)
print_first_and_last(sentence)
print_first_and_last_sorted(sentence)
Beispiel #19
0
import ex25
print(ex25.sort_words(ex25.break_words("gijo varghese")))