diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-03-08 23:32:11 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-03-08 23:32:11 +0000 |
| commit | a0ea2c78c8ac2bb33fb79ab151f86b3beb143647 (patch) | |
| tree | 41cbffecd69bd6774b09657b5702f620154cf9cb /challenge-207/robert-dicicco/python/ch-2.py | |
| parent | bc577f09f07be6abd72291c3e9a6642e4336d9c9 (diff) | |
| download | perlweeklychallenge-club-a0ea2c78c8ac2bb33fb79ab151f86b3beb143647.tar.gz perlweeklychallenge-club-a0ea2c78c8ac2bb33fb79ab151f86b3beb143647.tar.bz2 perlweeklychallenge-club-a0ea2c78c8ac2bb33fb79ab151f86b3beb143647.zip | |
- Added solutions by Avery Adams.
- Added solutions by Jaldhar H. Vyas.
- Added solutions by Mark Anderson.
- Added solutions by Luca Ferrari.
- Added solutions by Peter Campbell Smith.
- Added solutions by W. Luis Mochan.
- Added solutions by Paulo Custodio.
- Added solutions by Cheok-Yin Fung.
- Added solutions by E. Choroba.
- Added solutions by Bob Lied.
- Added solutions by Robbie Hatley.
- Added solutions by Matthias Muth.
- Added solutions by Lubos Kolouch.
- Added solutions by Solathian.
- Added solutions by Duncan C. White.
- Added solutions by Kjetil Skotheim.
- Added solutions by Marton Polgar.
- Added solutions by David Ferrone.
- Added solutions by Mariano Spadaccini.
- Added solutions by Robert DiCicco.
- Added solutions by Ulrich Rieke.
- Added solutions by Laurent Rosenfeld.
Diffstat (limited to 'challenge-207/robert-dicicco/python/ch-2.py')
| -rw-r--r-- | challenge-207/robert-dicicco/python/ch-2.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/challenge-207/robert-dicicco/python/ch-2.py b/challenge-207/robert-dicicco/python/ch-2.py new file mode 100644 index 0000000000..4327ca5d04 --- /dev/null +++ b/challenge-207/robert-dicicco/python/ch-2.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +''' +---------------------------------- +AUTHOR: Robert DiCicco +DATE : 2023-03-07 +Challenge 207 H-Index ( Python ) +================================== +''' +citations = [10,8,5,4,3],[25,8,5,3,3] + +def CalcIndex(c): + ln = len(c) + offset = ln - 1 + pos = ln + while offset >= 0 : + if c[offset] >= pos : + print("Output: ",pos,"\n") + return + else : + offset -= 1 + pos -= 1 + +for c in citations: + print("Input: @citations =",c) + CalcIndex(c) + +''' +---------------------------------- +SAMPLE OUTPUT +python .\HIndex.py +Input: @citations = [10, 8, 5, 4, 3] +Output: 4 + +Input: @citations = [25, 8, 5, 3, 3] +Output: 3 +---------------------------------- +''' |
