06.0 Python‎ > ‎Python Projects‎ > ‎

Box The Phrase

In the Box the Phrase Project you will be investigating Strings and how to manipulate them. Python has 5 other types of built-in data types the can be managed the same way as Strings. The skill set you will practice here on Strings will allow you to also manipulate: byte sequences, byte arrays, lists, tuples, range objects.

Objectives

The student will learn and use various String function to manipulate strings.
The student will use these skills with some of the other Python Sequence Data Types:  byte sequences, byte arrays, lists, tuples, range objects

Project Overview

Write a program that will write a phrase in the shape of a rectangle ( a box ) in the center of the screen.  Place a space between each letter on the horizontal line.  The determine the screen size of your full console screen.

Algorithm
Main Steps: (each of these will be a function  will be called from the main program.)
  1. Prompt the user for the phrase.
  2. Create/write the top of the box. ( with a space between each letter)
  3. Create/write the sides of the box .( no space between each letter)
  4. Create/write the bottom of the box.  ( with a space between each letter)
You will need to determine the algorithm for each of these methods.

Sample output:

B o x   t h e   p h r a s e
o                         s
x                         a
                          r
t                         h
h                         p
e
                          e
p                         h
h                         t
r
a                         x
s                         o
e s a r h p   e h t   x o B

Project Road Map

  1. Complete the Tool Box for Sequential Data Types investigation
  2. Enter a String and print it forwards with a space between each character. (top of box)
  3. also print it backwards with a space between each character. (bottom of box)
  4. Print the string vertically (one side)
  5. Print the string vertically backwards (the other side)
  6. Now merge the above two methods into one to print the string vertically forwards and backwards beside each other (both sides at the same time)
    1. You may need a HINT to do this -- see below
  7. Use the functions to build "Box the Phrase"

Hint: Count forwards and backwards at the same time

i = int(input ("Enter a number"))
for x in range (0,i):
    print ( str(x) + "  " + str(i-x))

In this code, one of the numbers will be off by 1. You will need to subtract on somewhere in this code
Comments