Question
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:
Answers
GPT-4o mini
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.
```python
# 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.
```python
# 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.
Related Questions
I'm a beginner to Java and I need to know how to do the following:
Write a program that will ask...
Write a program which allows user to enter 10 student names and scores for Java programming 1 and Ja...
Write a pseudocode to represent the logic of a program that allows a user to enter an hourly pay rat...
Draw a flowchart or write pseudo code to represent the logic of a program that allows the user to en...