Future String Methods

endswith():checks to see if string ends with a certain string. In this example it checks to see if it ends with a question mark. If it does, it returns True. If not, it returns False. txt= “Why me?” text1.endswith(“(span class=”string”>?

Read More

String Methods

There are many, many string methods. These are built in functions that allow you to perform operations on a string. All string methods – just like a function – return a new value and do not change the original string. Here’s some of simpler ones. We’ll talk about a few more in the next section…

Read More

Other String Operations

Python has a few funky ways of dealing with string issues and different ways you can manipulate a string from other languages.  Here are a few…some are useful…some are just fun! Multiplying What? Multiplying? Is that even possible? Apparently so! Here’s how it works: print (10 * ‘a’) Output is: aaaaaaaaaa Multi-line If you want…

Read More

What’s different with Strings in Python?

Python treats strings as arrays – not completely – but in quite a few aspects. How this is most readily available is in the way you can access a single character in a string. String Character Placeholders Each character in a string can be accessed by the number of it’s place in the string starting…

Read More

Psuedocode

Another way to layout out code is to write pseudocode. What is that? Basically just writing using normal English what steps you will take. It’s helpful to indent your pseudocode so you can see the structure. An example of using Pseudocode: Set the descriptions of the rooms in variables Set any in-depth descriptions of the…

Read More

Slicing Lists

Working with Lists It works similarly with lists Here is the basic syntax: list[startitem:enditem] Here are some examples: food = [“hot dog”, “cookie”, “eggs”, “bread”, “apple”] # prints out the first item print(food[0:1]) hot dog # prints out the 3rd and 4th item print(food[2:4]) eggs bread # prints out the last item print(food[-2:]) bread apple…

Read More

Step 7: Show the Plain 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 Show the Plain Message Once the message has been decrypted – display…

Read More

Step 5: Verify the User

Ask the user for a password to prove that they can see the message.  If the password matches proceed to the next step. Ask the user if they would like to see the “plain” message. If they say “Yes” – ask them for their password. Verify the password matches. Where will you store the password?…

Read More

Step 4: Show 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 Show the Message Once the message has been encrypted display it to…

Read More