Challenging Questions - need your help!

Hi!

I have been working on the Python challenge " Coffee Chatbot" and have a few questions. I am a very beginner at this!

  1. In the example attached below, what does “res” stand for? I see that it’s frequently used?

  2. how do I print to the terminal. I know it says “Write your code in the file called script.py and run it by entering python3 script.py in the terminal.” But when I do that it doesn’t print.
    See screenshot. What am I doing wrong?

  3. In the sentence "Alright, that’s a {size}{drinktype}! Why are double {}{} necessary?

  4. With the "name = input(“Can I get your name please? /n>”) What is the purpose of the /n> at the end? What does that stand for?
    I see it repeats a lot

  5. .format(name)) … What does the .format do?(http://bit.ly/usecodecademyforumsbetter). That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

  1. Try to see if you can see where the variable res is defined and that should give you a clue. (eg: res = 1+1)

  2. Entering python3 script.py in the terminal is telling python3 to run your python file: script.py. If you want to print to the terminal, in that script file you need to write a statement to print print(something) where something can be a variety of types (strings, integers, floats, objects).

Note, when you write a print statement, it’s location in the script matters, if it’s inside of a function, it will only run when that function is called.

  1. This has to do with string formatting. The curly bracket act as placeholders for variables. It is a very handy tool for writing for debugging. Look up string formatting for more detailed information.

  2. /n creates a new line. the / is an escape character which tells the compiler that the next character is going to be special and not printed.

  3. see#3

In general for most of these a really quick google search will yield a ton of information, part of learning Python can involve knowing how to ask really precise questions to google to learn these small details. Stackoverflow in particular has very good answers.

Additionally, if you want to build a solid base, a good reference manual goes a long way (like O’Reilley’s Python book), and some youtube channels go in depth into certain topics (like Corey Schaffer’s). There are subscription based services where you can get access to ton of books to reference as well (scribds is really cheap and has ton of python books).

5 Likes

Hi Toastedpitabread,

I deeply appreciate you being generous with your time!
I subscribed to Corey Schaffer and will look up the book that you recommended.
I appreciate your answers to my questions and the additional information.

Have you thought about becoming a Python tutor?
If so, is there a way to contact you directly?

Thank you again!

Respectfully,
Josh

1 Like