lambdas, and in a very limited way), it is not primarily a functional programming language, which is what you should be using based on your stated goal. Just keep in mind that, although Python has support for some functional features (e.g. There're more, so be sure to pick one of your interest. ![]() Some I've used myself include Racket (formerly Scheme), which is a dialect of Lisp, and SML (Standard ML). You should look at languages that were designed with the functional paradigm in mind from the outset. functional programming proficiency) task. Learning both is fine, but I would not recommend Python 2/3 as an ideal language for this (i.e. However, this will only teach you about Python (version 3 in my example) - not make you more familiar or proficient in the functional paradigm. See my example below: > from statistics import mean When all this is said and done, read the documentation or do searches like "python sum" or "python mean" before reinventing the wheel.Īs already mentioned, you should at least start by using Python's built-in sum function and could even look at the statistics module as someone else mentioned. This prints your value with a leading text, and let the float argument be printed with 2 decimals It's better to get used to a good code template like: print('Average of grades: '.format(grades_average(grades)) or similar.
0 Comments
Leave a Reply. |