This is an example:
You will define your function with the arguments and then you will evaluate it adding the value of the arguments.
]]>If you want a function with one argument you will write something like this:
If you want to use two arguments:
If you want to use a function with any argument
And that’s it, keep typing, keep coding.
]]>Give a name to your repository, add a description if you want to, select if you want it to be private or public, and initialized it a README.
This is how it looks, if you want to insert code click on README link
Then you could start typing or paste some code in this area
Finally, this is how it looks, you can copy the link and share it on your blog, twitter, Facebook, etc.
]]>For example:
I’m using the same example but the elif is included.
]]>
Here’s an example:
As you can see if z = 98, the first condition is not true, so the program will print the else statement.
]]>
for statement:
for loops are the best option when you want to repeat an action for a fixed amount of elements.
while statement:
The best moment for use a while loop is when you want a program to run a certain condition is reached.
recursion with functions
This one is better when you want to simplify your code or when the loops gets hard to do complex tasks.
]]>I’m going to declare a variable called team and I will use it for some examples.
Len
The function Len allows you to return the number of characters inside the string. The count starts with number 0
Traversal
This one is very helpful if you want to deal one string character at a time.
Slices
Slices are segment of strings.You could pick up a part of the string with this one.
Immutability
This means that you couldn’t replace an existing variable string at least you create a new one.
Counting
Basically this one allows you to count how many characters appears in a string.
]]>I’m talking about input function. When this function is called, the program stops and waits for the user to type something and the program continues when the user press return or enter.
After the input() function, Python received the text from the user and then assign the value to an variable text, after that, if the user prints the variable text, the user could see the text that wrote before.
Here’s an example:
That’s basically the way it is.
]]>
Here’s an example:
As you can see, at the end of the program it asks to the user if he/she want to try with another number or ends.
Nice, right?
]]>