« first day (43 days earlier)    last day (15 days later) » 

4:46 AM
@NathanOsman Hi
 
Hi.
So you need to ask the user some questions and then print a statement using the words they enter?
Did I understand the question right?
 
Yes.
something like a poem or a story
 
Okay.
 
Thanks
 
To obtain a string from the user, you can use the input() function like this:
name = input("Enter a name: ")
Then you can use the string's format() function to insert the value:
print("Hello, {}!".format(name))
The format() function expects one parameter for every {} in the string and it will substitute the {} for the value of the parameter in the order they are provided.
Does that help?
 
4:58 AM
It does, but its the part that talks about a poem or a story in the one I don't get
Also the user has to enter a minimum of 6 words repeatedly
 
Ah, so you could use a loop then:
words = []
for i in range(0, 6):
    words.append(input("Enter a word: "))
words is now a list of six words that you can access by index:
print(words[0])
...for example.
 
5:15 AM
Thanks,
Got to run to work. If I need some more help is it OK to ask?
Thanks
 
Sure!
Just remember to ping me so I don't miss it.
 
 
8 hours later…
1:36 PM
@NathanOsman hi
This works perfect.
How do you make it write a sentence with the entered words instead of just listing the word?
Enter a word: Nice
Enter a word: Tall
Enter a word: Male
Enter a word: Business Man
Enter a word: Married
Enter a word: Two Kids
Nice
Thanks
 
 
7 hours later…
8:57 PM
You can use the .format() string method to accomplish this.
print("I am a {} person.".format(words[0]))
...for example.
 
No I mean to create the sentence with all 6 words
 
Ah, well, you can use more than one {} in the string:
print("I am a {} and {} person.".format(words[0], words[1]))
Just keep adding more {} as needed and add a corresponding parameter to .format().
 
9:22 PM
Thanks a Million
 
No problem.
Glad to help.
 

« first day (43 days earlier)    last day (15 days later) »