Git Product home page Git Product logo

py-series's Introduction

py-series-basic

Basic python examples to calculate simple progressions and their sum

py-series's People

Contributors

laisvigas avatar vyvy-vi avatar

Watchers

 avatar

Forkers

laisvigas

py-series's Issues

[CHORE]: Project setup

Chore Request

Describe the work

Add the following:

  • linter(pylint)
  • formatter(black)
  • static type-checker (mypy)
  • unit tests (pytest)
  • CONTRIBUTING.md
  • Github actions that lint the code, run the code and test the code.

Additional information

[FEAT]: Reduce redundancy

Feature Request

Is your feature request related to a problem? Please describe:

Some redundant functions are present in the Series.py file.

Describe the solution you'd like

py-series/Series.py

Lines 65 to 108 in c8c106e

def n2_sum(ls):
#ls=[1,4,9,16]
for i in range(len(ls)-1):
if math.sqrt(ls[i])+1==math.sqrt(ls[i+1]):
continue
else:
return False
return True
def n3_sum(ls):
#ls=[1,8,27]
for i in range(len(ls)-1):
if (ls[i])**(1/3)+1==(ls[i+1])**(1/3):
continue
else:
return False
return True
def n4_sum(ls):
#ls=[1,16,81]
for i in range(len(ls)-1):
if (ls[i])**(1/4)+1==(ls[i+1])**(1/4):
continue
else:
return False
return True
def n5_sum(ls):
#ls=[1,32,243]
for i in range(len(ls)-1):
if (ls[i])**(1/5)+1==(ls[i+1])**(1/5):
continue
else:
return False
return True
def n6_sum(ls):
#ls=[1,64,729]
for i in range(len(ls)-1):
if (ls[i])**(1/6)+1==(ls[i+1])**(1/6):
continue
else:
return False
return True

The functions should be generalised to a new function nth_power_sum_check that takes an argument for parameter n

Additional context

[DOC]: make CONTRIBUTING.md file

Incorrect Documentation

Describe the error

Missing contributing file...

Expected information

Create a CONTRIBUTING.md file that guides people through setting up this project on their local machine, and successfully opening a pull request

Additional information

[FEAT]: Add support for primes

Feature Request

Is your feature request related to a problem? Please describe:

Describe the solution you'd like

Additional context

[FEAT]: add function to generate fibonacci series

Feature Request

Is your feature request related to a problem? Please describe:

Currently, this doesn't output the complete series with their sum for options other than AP and GP.

Describe the solution you'd like

  1. Create a new file fibonacci_generator.py and add a function in that file which takes one argument - n, and returns a list of n Fibonacci numbers along with their sum.

  2. Call this function in the Series.py file (line 116) and store them in variables m, n when type == 0:

    py-series/Series.py

    Lines 110 to 123 in c8c106e

    def print_series(ls, t):
    type= ["Fibbonaci","AP","GP","Sum of square","Sum of Cubes","Sum of N to 4th power","Sum of N to 5th power"]
    type=type[t]
    print(f'The type of this series is: "{type}"')
    n = int(input('Enter no.of terms in series that you want to print: '))
    if t==0:
    m,n= None,None
    elif t==1:
    m,n= apc(ls[0],ls[1]-ls[0],n)
    elif t==2:
    m,n= gpc(ls[0],ls[1]//ls[0],n)
    else:
    m,n= None,None
    print(f'The series is given by:\n{m}...\nThe sum of the "{type}" is:\n{n}')

Additional context

Check https://github.com/Vyvy-vi/py-series/blob/master/gps.py for reference.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.