Answer the question
In order to leave comments, you need to log in
What Python chips can be used on the exam?
This year I will take the exam in computer science. I chose python as a working language, and the following question arose: what features can I use? Is it possible to use list transformation, lambdas, standard min/max functions? I googled, and found nothing. And yet, I was told that when using a module, it does not need to be imported (allegedly everything is already imported), is this true? For example, I want to calculate the square root, what is the best way to do this?
# с импортом 1
from math import sqrt
sqrt(4)
# с импортом 2
import math
math.sqrt(4)
# без импорта 1
sqrt(4)
# без импорта 2
math.sqrt(4)
Answer the question
In order to leave comments, you need to log in
I don’t know the specifics of the exam, but from the experience of the olympiads, and it seems to me that the olympiad is no different from the exam, you can use any imports from the standard Python library.
Things like lists (just a data structure), filters (just a built-in function), lambdas (a way to define an anonymous function), and other language constructs are not worth worrying about. You definitely can and should use them (in the same bunch of dictionaries, maps, etc.).
The same math is also part of the standard library. If you want to show your horizons - implement the necessary functions "in place" and use them, indicating in the comment that an analogue of your implementation is contained in the standard library. If time is running out - use the built-in library. And don't forget that sorting or searching for min/max in quadratic time is a bad idea.
Specifying imports at the top, even if they are already done for you, will not be superfluous. It's great when you can take the examiner's code and give it to the interpreter without editing and get a meaningful result.
Regarding your example - good manners in python, not only on the exam, but also outside it - import the entire module and use its specific function, i.e. import math; math.sqrt(4). Why is it so? This makes it easy to read your code and clearly understand where this feature comes from. This makes the code more readable and concise, despite the fact that there are "many letters".
I wrote GIA in python in the 9th grade, indicated the version of python in the comment, explicitly imported modules, used only the standard library.
Saving a few lines in the simplest task is not worth the risk.
Look at the preliminary versions of the exam for this year, it should be written what you can use. If only the language is specified, then you can use all the features.
In the FIPI document "Informatics and ICT. Guidelines for assessing the performance of USE tasks with a detailed answer" from the series Methodological materials for chairmen and members of regional subject commissions for checking the performance of tasks with a detailed answer of the exam papers of the USE in 2016, we read:
"Also, 0 points should be evaluate the use of standard functions from libraries in programs in a programming language (for example, sorting an array in ascending order): the task does not check knowledge of the names of standard functions, but knowledge of algorithms"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question