top of page
Writer's pictureZack Scanlon

Cisco networking academy: Part 2 Data types, variables, basic input-output operations.

Python functions are much more flexible and can hold more content than their mathematical equivalent.


Cause some effect: send text to terminal, draw an image or play a sound.


evaluate a value or some values: finds the square root or length of inputted text


The text between the quotes are used so that they aren't seen as code and not executed, so whatever you put within will be taken literally.


 

Python will first check all of its internal data to in order to find an existing function with the corresponding name and if it can't it will abandon it. Then it will check if the function's requirements for the number of arguments allow you to invoke the function in the way you want. Next python leaves your code alone quickly and goes to the function you want to invoke and takes your arguments as well and passes them to the function. Then it executes the code to give the desired outcome and then python returns to your code and resumes the execution.


function_name(argument)

 

What is the effect of print()

it takes the argument and converts it into readable form and send then send the resulting data to the output (usually the console).


Pythons syntax is different as unlike most programming languages you can only have one instruction on a line a time. However a line can be empty. Putting a print() with make a gap between each of your print instructions when outputted.


n\ is the escape character and is used in strings and putting n next to a \ will create a newline when it is outputted.


commas can be used for separating arguments


end=""), dictates what should be printed after all of the arguments have been printed


sep="-") will separate a string by whatever character is in the double quotations marks of the separation argument.

print("Python", "is", "fun", sep="-")

output=Python-is-fun.


using an end and sep parameter to format a print function





0 views0 comments

Recent Posts

See All

Comments


bottom of page