Relative Content

Tag Archive for pythonfunction

What is necessary for any few lines of code to be a function in python?

I was taking a computer science class, and I was tasked to create a program that implemented a function which took parameters. My teacher told me that the following code is not a function leaving me confused as to what is necessary for some lines of code to be classified as a “function”.

Project Euler #16 with Python

So I’m trying to write a program to find the sum of digits of 2 to the power 100 using python, and this is my code so far.

How to optimize custom function to generate employee roster in python

I have created a function in python to generate a roster for inspection by selecting a pair of inspectors each for two teams (Team A and B) each week for the whole year. The function accepts two lists, one list is optional. A pair cannot be formed exclusively from list2, the optional list. The count of each person in each Team should be almost the same.

How to fix error in custom function to generate roster

I have created a function in python to generate a roster for inspection by selecting a pair of inspectors each for two teams (Team A and B) each week for the whole year. The function accepts two lists, one list is optional. A pair cannot be formed exclusively from list2, the optional list. The count of each person in each Team should be almost the same.

Creating a ratio from data assigned to two contestants in python

I have a problem with a bit of script that supposed to take some data – namely player/score numbers and create a ratio results for further analysis.
Colud someone pleasee help me – it’s probably a minor mistake but I’m not too experienced and just trying to adjust what I found on the net.
My data looks like this:

Please explain these dataclass functions’ definitions… (python)

Sorry, I really don’t know how to word this question.
I’m confused about the purpose of the content in the parenthesis after def (e.g (card: str) ) and what the -> symbol is doing. What is going on. And why does one function -> point to the class name and others point to basic data types. Help