Python library usage in Exams/Tests

So my friend and I were giving a test of a company and there was one question in which we had to count the same amount of numbers in the list and give the most common word or number. However my friend used a specific library and used Count function to do the job. While I made a whole lot of mess like loops , if , else and other things . I wanted to ask that is it okay to use libraries from python that makes the job easy in the online tests/examinations.

Yes, you can use any inbuilt library in python, as long as your IDE supports it. But personally, I would advice you to switch to C/C++ when it comes to Competitive Programming, as python takes a lot of time to run when compared to C/C++. Most of the Contests that you attend do not provide the extra time unlike codechef for python, which eventually makes your code get a TLE. Python is widely used in data science, whereas C/C++ proves to be efficient in coding contests.