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 trialdel maddox
2,514 PointsI used the string conversion code from the tutorial lecture. when I run python string_multiply.py. there's no message
Make new file called string _multiply.py /* Need to add some variables
Input_string = input(“ What string do you want to uses “) Input_int = input(“How many times should I repeat it ?”)
Print(input_string * int(input_int))
When I run python string_multiply.py I do not receive the message prompt from the defined variable (“ What string do you want to uses “) or (“How many times should I repeat it ?”) . I seem to be having problems trying to get python run the code after they are declared
4 Answers
Chris Bennett
7,499 PointsYou just have a few syntax errors:
- You need to use raw_input() instead of input().
- Variable names should be all lower_case(this does not throw an error it is just a python convention)
- Print() needs to be print() , all lower-case. This will throw an error because python is case sensitive.
input_string = raw_input("What string do you want to use?")
input_int = raw_input("How many times does it repeat?")
print(input_string * int(input_int))
Jesse Dickson
2,329 PointsMake sure to Save your work before attempting to run the code.
larry sigo
4,067 Pointsreplace the input () with raw input it the variable
larry sigo
4,067 Pointsreplace the "input()" with "raw_input()" in both variable and try it is going to work