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 1 year ago.
Improve this question
Can someone give a suitable example of the XOR Operator in Python ? I understand its definition but couldn’t implement it. So, please explain with a suitable example.
Thanks in advance
This is a fair enough implementation:
def xor(a:bool, b:bool)->bool:
return (not a) == (b)
Related
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 5 days ago.
Improve this question
Problem: http://usaco.org/index.php?page=viewproblem2&cpid=664 (USACO 2016 Bronze December)
So is this problem generally asking how many of each letter are in all the words together; meaning it is asking to print how many a's there are in all the terms together, how many b's are all together, etc.?
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 last month.
Improve this question
For a class projet, i want to be able to predict the result of a random.shuffle, but what i learned about the random module is way more advance than everything i learned so far.
Do you have any idea of how it could be done ?
I found some code that allowed me to predict the result of randint, but nothing for shuffle
The following code should always give the same output:
lst = [0,1,2,3,4]
random.seed(5)
random.shuffle(lst)
print(lst)
My guess is that if you managed to make it work for other methods, you simply forgot to reinitialize the list each time
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 2 months ago.
Improve this question
The details of the project is to get the solution of oops features from the above statement.
I have expected some related solutions for the above question.
Thank you!
features of OOP's are:
Inheritance.
Encapsulation.
Abstraction.
Polymorphism.
Method Overriding.
Method Overloading.
Objects.
Classes.
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 6 years ago.
Improve this question
the corresponding pattern is ('Handmade Frozen Car', 11.0). I want to get the value as 11.0. Any suggestions are highly appreciated.
x = ('Handmade Frozen Car', 11.0)
secondElement = x[1]
secondElement will be equal to 11.0