Your very first program! - Hsanokklis/2023-2024-Tech-journal GitHub Wiki
Functions
Functions are meant to either cause some effect or evaluate a value and return it as the function's result
function arguments
function arguments are whatever goes with in the parentheses, ie in print('Hello World') the argument would be 'Hello World'.
The print() function
The only argument that can be delivered to the print() function is a string
a string is delimited with quotes (""). They says that whatever is written inside of them will be taken as is an NOT executed.
Lab: Become familiar with the Print() function
- use the
print()function to print the lineHello, Python!
- Use the
print()function again but print your first name
- You can use the
print()function on its own to create a line separation
the escape and newline characters
\n
- the backslash
\is otherwise known as an escape- This means that when inserted into code, its pausing and including something
- the n stands for newline
The code above prints as:
Using multiple arguments
- One way to combine arguments within a string is with commas
Keyword arguments
These are arguments that are added to the end of a string in the print() function and can change the output of the string