Write a program that will ask the user to enter their name and the state they live in. Print the following sentence, replacing the ______ with the words they entered. My name is _____. I live in _____. Sample Run:

1 answer

Here’s a simple Python program that prompts the user to enter their name and the state they live in, and then prints the formatted sentence using the entered values.

# Program to ask for user's name and state

# Ask for the user's name
name = input("Please enter your name: ")

# Ask for the user's state
state = input("Please enter the state you live in: ")

# Print the formatted sentence
print(f"My name is {name}. I live in {state}.")

Sample Run:

Please enter your name: Alice
Please enter the state you live in: California
My name is Alice. I live in California.

You can run this program in any Python environment, and it will work as described.