Python Language Functions: Difference between revisions
Jump to navigation
Jump to search
Line 19: | Line 19: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=Built-in Functions= | =Built-in Functions= | ||
==<tt>type()</tt>== | |||
<code>type()</code> returns the type of the argument. | |||
==<tt>print()</tt>== | |||
<code>print()</code>. If more comma-separated arguments are used, every comma adds a space. | |||
==<tt>input()</tt>== | |||
<code>input()</code> instructs Python to pause and read data from stdin. <code>input()</code> returns a string. | |||
<syntaxhighlight lang='python'> | <syntaxhighlight lang='python'> | ||
s = input('this is the prompt') | s = input('this is the prompt') | ||
print(s) | print(s) | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 20:13, 22 May 2021
Internal
Overview
Declaration:
def function_name(arguments):
<function body>
Invocation:
function_name(arguments)
Example
def something(a, b):
c = a + b
return c
Built-in Functions
type()
type()
returns the type of the argument.
print()
print()
. If more comma-separated arguments are used, every comma adds a space.
input()
input()
instructs Python to pause and read data from stdin. input()
returns a string.
s = input('this is the prompt')
print(s)