1 Replies - 203 Views - Last Post: 01 July 2019 - 09:24 AM Rate Topic: -----

#1 yellowcab   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 25-June 19

Calculating delta numbers from an excel spreadsheet

Posted 01 July 2019 - 01:05 AM

I want to calculate delta numbers from an excel spreadsheet. Right now I can calculate delta numbers only for one row. I want to automate the process of calculating delta numbers.
Here's my code:

import os
os.chdir("/Users/user/Desktop")

import openpyxl
wb = openpyxl.load_workbook('lotto.xlsx')
sheet = wb.active

def delta():
    a = sheet['A2'].value
    b = sheet['B2'].value - sheet['A2'].value
    c = sheet['C2'].value - sheet['B2'].value
    d = sheet['D2'].value - sheet['C2'].value
    e = sheet['E2'].value - sheet['D2'].value
    f = sheet['F2'].value - sheet['E2'].value
    return [a, b, c, d, e, f]

delt = delta()
delt.sort()

if delt[-1] < 16:
    print("The delta numbers are: " + str(delt))
else:
    print("These are not delta numbers.")


Here is the excel spreadsheet:

http://ge.tt/3lZEnrw2

Is This A Good Question/Topic? 0
  • +

Replies To: Calculating delta numbers from an excel spreadsheet

#2 yellowcab   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 14
  • Joined: 25-June 19

Re: Calculating delta numbers from an excel spreadsheet

Posted 01 July 2019 - 09:24 AM

This was solved on stackoverflow.com.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1