Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (Retired) Things That Count Things That Count

If I am creating a variable, how to I create a sentence with another variable separated from the rest of the sentence.

Also, What punctuation should I use.

For example, If I am creating a variable named lemon, and I wanted that variable to be a sentence with a different, previously created variable in the sentence.

Thanks

days_alive.py
age = 13
days = age * 52 * 7
summary = "I am days old!"

1 Answer

s=summary.split() # it will make your sentence to string array print(s)

now you can use any part by array index like s[0] or s[1] or s[3]<last index

print(s[2]) # to see the results