Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Programmer: Logan Creech
- # Date: 6/8/11
- # File: Dialogue.py
- # This program simulates a dialogue between the computer and a person while demonstrating splicing.
- def main():
- phrases = "Thank You Please Hello Hi are in and live language this is" # Add to the phrases in this string literal
- print phrases[17:22] # This statement prints a specific segment of characters from the string literal
- name = raw_input("What is your name? ") # This This statement prompts the user to enter their name and accepts the name the user enters
- print phrases[23:25] + " " + name + "." # This statement retrieves a specific segment of characters from the string literal, concatenates it with the person's name, and speaks the result
- Age = raw_input("What is your age? ") # This will get the persons age.
- print phrases[6:9], phrases[26:29] + " " + Age + "." # I added the second phrase to get more words from the variable.
- address = raw_input("What state do you live in? ") # This will get the user's state.
- print phrases[6:9], phrases[26:32] + " " + address + "." # This prints the user's state.
- language = raw_input("What programming language is this? ") # This will get the programming language from the user.
- print phrases[51:59] + " " + language + "." # Prints the language that the user inputs.
- print phrases[23:25] + ", " + name + ", " + phrases[6:9], phrases[26:29] + " " + Age + ", " + phrases[6:9] + " " + phrases[37:41], phrases[30:32] + " " + address + ", " + phrases[33:36] + " " + phrases[51:59] + " " + language + "."
- # This brings all of the information together into one sentence, summarizing all that was inputted into the program.
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement