









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










print("Welcome to System Security Inc.") print("-- where security is our middle name\n")
password = input("Enter your password: ")
if password == "secret": print("Access Granted")
print("Welcome to System Security Inc.") print("-- where security is our middle name\n")
password = input("Enter your password: ")
if password == "secret": print("Access Granted") else: print("Access Denied")
print( """
| | | O O | | < | | | | .'. |
""") else: print("Illegal mood value! (You must be in a really bad mood).")
print("...today.")
print("\tWelcome to the 'Three-Year-Old Simulator'\n") print("This program simulates a conversation with a three-year-old child.") print("Try to stop the madness.\n")
response = "" while response != "Because.": response = input("Why?\n")
print("Oh. Okay.")
message = input("Enter a message: ")
print("\nThe length of your message is:", len(message))
print("\nThe most common letter in the English language, 'e',") if "efg" in message: print("is in your message.") else: print("is not in your message.")
import random
word = "index hello" print("The word is: ", word, "\n")
high = len(word) low = -len(word)
for i in range(10): position = random.randrange(low, high) print("word[", position, "]\t", word[position])
inventory = ()
if not inventory: print("You are empty-handed.")
input("\nPress the enter key to continue.")
inventory = ("sword", "armor", "shield", "healing potion",
print("\nThe tuple inventory is:") print(inventory)
print("\nYour items:") for item in inventory: print(item)
def instructions():
print( """ Welcome to the greatest intellectual challenge of all time: Tic- Tac-Toe. This will be a showdown between your human brain and my silicon processor. You will make your move known by entering a number, 0 - 8. The number will correspond to the board position as illustrated: 0 | 1 | 2
6 | 7 | 8 Prepare yourself, human. The ultimate battle is about to begin. \n """ )
print("Here are the instructions to the Tic-Tac-Toe game:") instructions() print("Here they are again:") instructions() print("You probably understand the game by now.")
def birthday1(name, age): print("Happy birthday,", name, "!", " I hear you're", age, "today.\n")
def birthday2(name = "Jackson", age = 1): print("Happy birthday,", name, "!", " I hear you're", age, "today.\n") birthday1("Jackson", 1) birthday1(1, "Jackson") birthday1(name = "Jackson", age = 1) birthday1(age = 1, name = "Jackson")
birthday2() birthday2(name = "Katherine") birthday2(age = 12) birthday2(name = "Katherine", age = 12) birthday2("Katherine", 12)