Advertisement
NeverPool

Untitled

Jul 26th, 2011
3,103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PyCon 1.71 KB | None | 0 0
  1. # Programmer: Logan Creech
  2. # Date: 6/8/11
  3. # File: Dialogue.py
  4.  
  5. # This program simulates a dialogue between the computer and a person while demonstrating splicing.
  6.  
  7. def main():
  8.  
  9.     phrases = "Thank You Please Hello Hi are in and live language this is"       # Add to the phrases in this string literal
  10.  
  11.     print phrases[17:22]                        # This statement prints a specific segment of characters from the string literal    
  12.     name = raw_input("What is your name? ")     # This This statement prompts the user to enter their name and accepts the name the user enters
  13.     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
  14.     Age = raw_input("What is your age? ")   # This will get the persons age.
  15.     print phrases[6:9], phrases[26:29] + " " + Age + "." # I added the second phrase to get more words from the variable.
  16.     address = raw_input("What state do you live in? ") # This will get the user's state.
  17.     print phrases[6:9], phrases[26:32] + " " + address + "." # This prints the user's state.
  18.     language = raw_input("What programming language is this? ") # This will get the programming language from the user.
  19.     print phrases[51:59] + " " + language + "." # Prints the language that the user inputs.
  20.     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 + "."
  21.     # This brings all of the information together into one sentence, summarizing all that was inputted into the program.
  22. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement