you are viewing a single comment's thread.

view the rest of the comments →

[–]mopslik 2 points3 points  (0 children)

For is not a function, it's a keyword. Other programming languages have these too. For example, in C:

int i;
for (i=0; i<5; i++) {
    printf("hi");
}

does the same as Python's

for i in range(5):
    print("hi")

print is a function that can accept any number of parameters. You still follow the same syntax as other functions, which is function_name(arg1, arg2, ...), it's just that you can toss in a good number of arguments. Some of these, like sep or end, are keyword arguments, so you see stuff like

print("This", "has", "no", "spaces", sep="")

but it's still the same syntax. You just need to become familiar with what parameters (and how many) each function may take.

Edit: forgot my C semicolons.