Contents

  1. ./ascii.py
  2. ./ascii_table.py
  3. ./temp_table.py
  4. ./top_down_encrypt.py

./ascii.py 1/4

[
top][prev][next]
# Conversion of a text message into ASCII
# by Sara Sprenkle

print()
print("This program converts a textual message into a sequence")
print("of numbers representing the ASCII encoding of the message.")
print()

message = input("Enter the message to encode: ")

print()
print("Here are the ASCII codes for '" + message + "':")

for ch in message:
    print(ord(ch), end=" ")

print()

./ascii_table.py 2/4

[
top][prev][next]
# Create a table of numbers (ASCII) and their character equivalent.
# by Sara Sprenkle

print("This program prints out part of the ASCII Table")
print("The ASCII value is followed by the character.")

for i in range(33, 127):
    print(i, "-->", chr(i))
    

./temp_table.py 3/4

[
top][prev][next]
# Print out the table of temperatures
# By CS111

# Better to calculate the temperature conversions. 
# but that's not the focus today

"""
Desired output: 

Temp F      Temp C      Temp K
------      ------      ------
-459.7      -273.1         0.0
   0.0       -17.8       255.2
  32.0         0.0       273.1

"""

# display the labels

# template for the headings:
headings_template = "{:>6s}{:>12s}{:>12s}"
print(headings_template.format("Temp F", "Temp C", "Temp K"))
print(headings_template.format("-"*6, "-"*6, "-"*6))



# display the data

# template for the data:
data_template = "{:6.1f}{:12.1f}{:12.1f}"

ftemp = -459.67
ctemp = -255.2
ktemp = 0

print(data_template.format(ftemp, ctemp, ktemp))


ftemp = 0.0
ctemp = -17.7778
ktemp = 255.372

print(data_template.format(ftemp, ctemp, ktemp))


ftemp = 32
ctemp = 0
ktemp= 273.15

print(data_template.format(ftemp, ctemp, ktemp))



./top_down_encrypt.py 4/4

[
top][prev][next]
# top-down template (i.e., not completed) for encrypting a message.

def main():

    # get user input for message and key
    
    # confirm that user input and key are valid; if not, stop
    
    # encode message
    
    # display encoded message
    
def encrypt_letter(lowercase_letter, key):
    """
    Parameters:
        lowercase_letter: 
        key: 
    returns the lowercase_letter encrypted using key
    """

Generated by GNU Enscript 1.6.5.90.