#πŸ”’ unexcpected output

9 messages Β· Page 1 of 1 (latest)

weary nacelle
#

i thought that when printing x, you only get the value assigned to it which is "Hello world, and". it printed an additional line. and when printing y, i thought you get "hello, qaz"

hollow groveBOT
#

@weary nacelle

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

urban pagoda
#

Print by default will print your string and a new line character. It has a parameter that lets you specify if you want a different end on the string

#

Likewise, there is a default sep parameter which is a space.

#
print(*objects, sep=' ', end='\n', file=None, flush=False)ΒΆ
Print objects to the text stream file, separated by sep and followed by end. sep, end, file, and flush, if present, must be given as keyword arguments.

All non-keyword arguments are converted to strings like str() does and written to the stream, separated by sep and followed by end. Both sep and end must be strings; they can also be None, which means to use the default values. If no objects are given, print() will just write end.

The file argument must be an object with a write(string) method; if it is not present or None, sys.stdout will be used. Since printed arguments are converted to text strings, print() cannot be used with binary mode file objects. For these, use file.write(...) instead.

Output buffering is usually determined by file. However, if flush is true, the stream is forcibly flushed.
tired otter
hollow groveBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.