Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
This post was edited and submitted for review 3 months ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
If the integer is 2013, then the maximum number would be 3.
How would I proceed to doing so?
max([int(c) for c in str(2013)])
First you convert the number to a string, this allows to look at every digit one by one, then you convert it into a list of single digits and look for the maximum.
Another solution is
max = -1
for c in str(2013):
i = int(c)
if i > max:
max = i
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 days ago.
Improve this question
So this is the list. The list contains 9 indexes and inside each indexes, there at least one position that contains more than one number. Is there a way to access each number in those posistions?
I have tried:
print(self.nums[0][1][0])
I thought that it would print out the first number of that posistion in the first index, but i recieved an error message instead.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 days ago.
Improve this question
I would like to know how to find the values of a list that result in the sum of a specific value example that I have a list of payments but a payment is found that comes from different values of the list that added together result in the total value of the payment
I just want to know how to find the values of a sum in a way to be program it
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
How should I do to divide years in half a year in this case if running in Python code?
I wasn't sure if you wanted horizontal or vertical divisions so I gave you both.
More practically, maybe this answer will help?
Creating numpy linspace out of datetime
You can specify start and end date and the number of divisions.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Tetravocalic: Find all words that include four consecutive vowels.
def Tetravocalic(i):
return(re.search("/\b.*[aeiou]+.*[aeiou]+.*[aeiou]+.*[aeiou]+{4}/\b",i)))
Tetravocalic("vajjekiohkkugh")
error: multiple repeat at position 42
Please let me know the meaning of the error and the correct code as well.
ex: Tetravocalic("vajjekiohkkugh apple ororaeeg")
Your regular expression is way too complex, you only need this :'[aeiou]{4}'.
Example code:
def has_four_consecutive_vowels(s):
return bool(re.search('[aeiou]{4}', s))
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to know the number of possible combinations to fill an array that contains 25 boxes (array 5*5) which can be fill with 2 symbols (0 or 1). How can I do this?
Thanks in advance.
def combinations(S,K):
return S**K;
Since there are 25 bits here, your answer is 2^25 = 33554432