Step 2: Create the Key
Here’s our plan for this program: Have your program create a random message Come up with an encryption key Encrypt the message Show the encrypted message Ask user for a key/password to decrypt message Decode back into plain text Display the plain message What We’ve Done: In Step 1, we created the message which should…
Read MoreHomework: Slice Function
Let’s create a new program to play with this one called wordplay.py. Add this functionality: Ask the user their first name, favorite color and favorite random object. Take the first three letters of their first name, 2nd and 3rd letters of color and last 2 letters of their random object. Then output this as their…
Read MoreHomework: Nested Conditionals
Create a file called nested.py in PythonAnywhere where the program does this: Ask the user for their age and number of siblings. If they have no siblings, print a message. If they do have siblings – ask them if they have younger siblings. If they do have younger siblings ask them if they have older…
Read MoreNested Conditionals
A Nested Conditional is simply a conditional statement inside of a condition. Let’s use our weather example. #find out what the temperature is and what day of the week temp = int(input(“What is the temperature?”)) day = input(“What day of the week is it?”) #if is a weekend-you can do something depending on the weather…
Read MoreStep 6: Decrypt the Message
Here’s our plan for this program: Have your program create a random message Come up with an encryption key Encrypt the message Show the encrypted message Ask user for a key/password to decrypt message Decode back into plain text Display the plain message We are working off this structure. I’d suggest something like this: #initialize…
Read MoreStep 3: Encrypt the Message
Here’s our plan for this program: Have your program create a random message Come up with an encryption key Encrypt the message Show the encrypted message Ask user for a key/password to decrypt message Decode back into plain text Display the plain message We are working off this structure. I’d suggest something like this: #initialize…
Read MoreStep 1: Create the Message
Here are the steps for creating this tool: Have your program create a random message Come up with an encryption key Encrypt the message Show the encrypted message Ask user for a key/password to decrypt message Decode back into plain text Display the plain message Step 1: Create Message We’ll use Python to create the…
Read MoreReturning Data From Functions
Often you want the function to perform some sort of operation or logical test and return some information. You do this by using the return keyword. Basic Syntax def function_name(parameter1, parameter2,…) #Code here return return_value Simple Example def calc_area(width, length): area = width * height return area # MAIN # You can store the value…
Read MoreHomework Help: guess_functions.py
Not enough permissions to view this content.
Read MoreThe Game of Nims
This lesson is intended to continue to work on your ability to design a program from the beginning. As a reminder from Lesson 10 in the Basics of Python: Before you begin writing coded, spend some time figuring out what the program does. Here are some good basic questions to start with. What information does…
Read More