0% found this document useful (0 votes)
155 views

String Input (1)

The document describes an assignment to create a Python program that simulates a chatbot conversation. It provides guidelines for the program, including having at least three interactive prompts, assigning user input to variables, and using string indexing or slicing. It includes sample pseudocode for the conversation. The second part instructs the student to code the program in Python using comments and meaningful variable names. It provides an example output. The coded program asks the user for their name, favorite sport, and the third letter of the sport. It provides this information back along with the student's favorite sport and a sport starting with the user's third letter. The final part asks the student to complete a post mortem review describing the program's purpose, potential real

Uploaded by

Paromita Tiwari
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views

String Input (1)

The document describes an assignment to create a Python program that simulates a chatbot conversation. It provides guidelines for the program, including having at least three interactive prompts, assigning user input to variables, and using string indexing or slicing. It includes sample pseudocode for the conversation. The second part instructs the student to code the program in Python using comments and meaningful variable names. It provides an example output. The coded program asks the user for their name, favorite sport, and the third letter of the sport. It provides this information back along with the student's favorite sport and a sport starting with the user's third letter. The final part asks the student to complete a post mortem review describing the program's purpose, potential real

Uploaded by

Paromita Tiwari
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 3

Name___Paromita Tiwari_______________ 01.

05 String Input

This assignment has three parts.

Part One: Write a program to simulate a chatbot conversation. Use the following guidelines to write your
program:

1. Decide on an interactive 4. At least once, use the indexing


conversation someone could have with or slicing technique.
a computer. 5. Use concatenation to join string
2. Your program should include at literals and string values.
least three interactive prompts. 6. Write the pseudocode for this
3. Input from the user should be program. Be sure to include any input
assigned to variables and used and output needed.
throughout the conversation.

Insert your pseudocode here:

Input: Ask the user what their name is. Ask the user what their favorite sport is. Ask the user what the
third letter of their favorite sport is. Ask the user what other sport starts with that letter.

Output:
Tell the user my name; tell the user my favorite sport and third letter of my favorite sport. Tell the user
what other sport starts with that letter and tell them their answers to all of the questions.

Part Two: Code the program. Use the following guidelines to code your program.
1. Code the program using Python 3. Use meaningful names for all
IDLE. variables.
2. Using comments, type a 4. Follow the Python style
heading that includes your name, conventions regarding indentation and
today’s date, and a short description of the use of white space in your program.
the program.

Example of expected output: The output for your program should resemble the following screen shot.
Your specific results will vary depending on the choices you make about the conversation and the input
provided.
Insert a copy of your code from the IDLE here:

# Paromita Tiwari

# 11/7/2019

# Purpose: To create a program that acts as a chatbot with a use

def main():

print("Hi, I'm Paromita!")

userName = input("What is your name?")

favSport = input("What is your favorite sport?")

print("Hello, " + userName + "!")

print("You said your favorite sport was " + favSport + ".")

print("My favorite sport is fencing. The third letter of 'fencing' is n.")

print("A sport that starts with 'n' is Novuss, the national sport of Latvia.")

thirdLetter = input("What is the third letter of your favorite sport?")

print("You said " + thirdLetter + " as the third letter of your favorite sport.")

print("If you answered " + favSport[2] + ", you're right!")

otherSport = input("What other sport starts with the third letter of your favorite sport?")

print("You said " + otherSport + " starts with the third letter of your favorite sport.")

print(otherSport + " is a cool sport too!")

main()
Part Three: Complete the Post Mortem Review (PMR). Write thoughtful two to three sentence responses
to all the questions in the PMR chart.
Review Question Response
What was the purpose of your The purpose of my program was to create a program resembling
program? a chatbot that someone could talk with. The ultimate goal was to
entertain the user.

How could your program be useful in It is useful in the real world to entertain someone with the
the real world? program. If someone feels alone, something like this could help
them feel like they are actually talking to someone.

What is a problem you ran into, and A problem I ran into was that I was unable to figure out how to
how did you fix it? add spaces in between concatenated variables so when I ran the
program, the result would be words mashed together. I figured
out that you have to add spaces in the quotations before and
after the added variable to make sure it shows up as a single
word.
Describe one thing you would do I will be careful to place my spaces correctly. I will also make sure
differently the next time you write a I have two sets of quotations for every string literal so I don’t
program. receive any errors.

You might also like