Created
July 26, 2020 08:29
-
-
Save kavilivishnu/dcb668605ce34eda157dafa7574f2c47 to your computer and use it in GitHub Desktop.
A Recursive code which can be used for any filtering process.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
In the below code, I just took the modulo criteria for the filtering process. | |
if res = 0: The so and so person secured more than 80% or can be taken in any other aspect i.e. the work experience in so and so field.. etc etc.. aspects | |
if res = 1: >70% | |
if res = 2: >60% | |
Or the criterias can be taken the other way i.e. 0: 60% - 70%, 1: >=70% - 80%, 2: >80% | |
The criteria can be choosen based on changing the number than we're performin modulo operation with. | |
''' | |
Recursive Operation | |
''' | |
Below is the code: | |
''' | |
def pass_check(num): | |
if num < 1: | |
return 1 | |
else: | |
res = num % 3 | |
if num == 0: | |
print(num) | |
else: | |
pass_check(num - 1) | |
print(res, ":", num) | |
pass_check(100) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment