Python Python Basics Meet Python Using Input

"favorite color"

not sure if im using "print" for this one?
favorite_color=input("What is your favorite color?")
print("The color blue is my favorite!")

2 Answers

Kamaren McCord
Kamaren McCord
11,031 Points

Alright, so you almost have it here. It looks like you are manually entering the color "blue" into the print statement. The problem with that is that if the user puts in literally ANYTHING else, than 'blue', it will not be accurate. So what you need to do is use a string format to put the variable into the print statement


variable_one = 'this is the insert'
print('this is my string, {}'.format(variable_one))

where the output will look like:

this is my string, this is the insert
turaboy holmirzaev
turaboy holmirzaev
14,266 Points

Also, if you are using python 3.6 or higher, you can make use of "f string" which is very convenient.

    variable_one = 'this is the insert'
    print(f'this is my string, {variable_one}')

you can learn more about it here