Search code examples
pythonpycharm

Pycharm quotation issues


So, pretty new with coding in general and im running into an issue. My assignment this week is to run a quick program that takes a name, and age and spit out a quick prompt repeating the name and stating a birth year. the big problem is PyCharm is putting everything in quotations.

So, with my input

user_name = raw_input('Enter your name:')

user_age = int(input('Enter your age:'))

birth_year = (2022 - user_age)

print('Hello', user_name+'!' ' ' 'You were born in', birth_year)

I am getting the output

Enter your name:Ryan

Enter your age:27   

('Hello', 'Ryan! You were born in', 1995)


Process finished with exit code 0

Is this just something PyCharm does? I would love to get rid of all the quotation marks, but I also don't know if im just being too picky about formatting. I appreciate any advice!


Solution

  • You are using a combination of , and + to concatenate strings and some (seemingly) random '. This should work:

    print('Hello ' + user_name + '! You were born in ' + str(birth_year))
    

    The problem with your implementation is that python turns your output into a tuple (because of the ,) with the values you are seeing in your output.