Smartgambler
Pro-Punter

Go Back   OZmium Sports Betting and Horse Racing Forums > Public Forums > General Topics
User Name
Password
Register FAQ Search Today's Posts Mark all topics as read

To advertise on these
forums, e-mail us.

Reply
 
Thread Tools Search this Thread Display Modes
  #71  
Old 7th August 2018, 09:20 PM
Puntz Puntz is offline
Member
 
Join Date: Jan 2012
Posts: 557
Default

About to Post a reply and got disconnected,

Thanks UB, makes sense. ( had a reply though, but yeah)


That book though, go through it and then ya see why the keyboard's number pad is such a way in regards to when Python does a formula,
the order of the, " / * - and +" are for a reason.

So if one was to do a calculation in .py, if it ain't done in the right sequence with brackets, ya have 2 different answers, both correct though.
Reply With Quote
  #72  
Old 7th August 2018, 10:08 PM
blackdog1 blackdog1 is offline
Member
 
Join Date: Aug 2013
Posts: 462
Default

Quote:
Originally Posted by Puntz
About to Post a reply and got disconnected,

Thanks UB, makes sense. ( had a reply though, but yeah)


That book though, go through it and then ya see why the keyboard's number pad is such a way in regards to when Python does a formula,
the order of the, " / * - and +" are for a reason.

So if one was to do a calculation in .py, if it ain't done in the right sequence with brackets, ya have 2 different answers, both correct though.
Big mistake that. have a look at this,https://www.skillsyouneed.com/num/bodmas.html
Reply With Quote
  #73  
Old 8th August 2018, 02:42 AM
Puntz Puntz is offline
Member
 
Join Date: Jan 2012
Posts: 557
Default

Quote:
Big mistake that. have a look at this,https://www.skillsyouneed.com/num/bodmas.html


ok, scroll down the bottom of that page, and it says what Python does anyway, do " division and multiplication first"

But the mechanics of the code, what the book says to try at the prompt in IDLE is,

it says to try ( page 18 )
A:
5 + 30 * 20 ( press Enter )
Answer: 605

or
B:
(5+30) * 20 ( press Enter )
Answer: 700

Because in A, python will first do either the / or * calculation, then add the 5
So it becomes 30 * 20 + 5, becomes 605

In B, because of the brackets it will first add 5 + 30 ( 35 ) then multiplies by 20, becomes 700


Reason it explains is
Quote:
" Multiplication and Division have a higher order than Addition and Subtraction, which means that they're performed first"



Try the same on a standard calculator, you get 700
Reply With Quote
  #74  
Old 8th August 2018, 07:00 AM
UselessBettor UselessBettor is offline
Member
 
Join Date: Sep 2011
Posts: 3,711
Default

Puntz,

You must have hit equals on the calculator.

The order is always brackets, multiply or division, add and subtraction.

I just did this with my daughter for her year 6 math homework last week.
Reply With Quote
  #75  
Old 8th August 2018, 09:28 AM
Puntz Puntz is offline
Member
 
Join Date: Jan 2012
Posts: 557
Default

Quote:
You must have hit equals on the calculator.


Of course, ya suppose to hit equals on the calculator, to make it calculate.

What I was saying is, while learning to code in .py, the book pointed out the difference using those brackets or not.
It's the not formula, it's "seeing" the mechanics of how it does operate, the process, the engine side of things.
To me a "syntax error" is a lose part gone missing or left out and the engine won't run.
Or, the timing's out by a tooth or two.

Tested the same as a formula in Excel
=5+30*20
605

=(5+30)*20
700
Which I always knew anyway about brackets (parenthesis ?) in Excel.
Reply With Quote
  #76  
Old 16th August 2018, 08:52 PM
Puntz Puntz is offline
Member
 
Join Date: Jan 2012
Posts: 557
Default

OK, next boook,
Python crash course ( eric mathers )
524 pages.

What I am finding though with most author's, "about the author",
On average the say they started to write code from ages 5 to 8 or 9's.
So, that's OK, but it does not mean they write great beginner books, cos the empathy factor is simply not there, they write a "how to" book, assuming one already knows, who is reading the book.
But this book, is written not just the code, but the why...
The other thing, in the example is, it has examples how to write and read to or from txt files.

Nothing specifically on web query the way I require, yet.....

Also, I do a bit of mental editing in their code examples.
They use dogs, cats, names, apples, carrots etc.
Nothing relevant to horrrrrse raaaaaacingnnnnng or the punt,
I have changed "hello world" to "Warick Farm"
dog to horse, cat to colt, geldings or mares and names like fred to previous Melbourne cup winners, and carrots to green grass horse feed.

Last edited by Puntz : 16th August 2018 at 08:56 PM.
Reply With Quote
  #77  
Old 16th August 2018, 10:43 PM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 5,318
Default

I honestly don't have the time to learn another programming language but i find with the knowledge i have i can search a particular topic then adjust to what i need, all my research has been just on web scraping, there is lots out there.

I also want to learn how to import in to an SQL server but excel will do for now as i can manipulate the imported data, some of the hardest thing i and doing right now is specific table or content selection from the webpage, i am unsure of the correct syntax at times so is trial and error, for loops are also a pain, just understanding how they cycle through the data.
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #78  
Old 16th August 2018, 11:49 PM
Puntz Puntz is offline
Member
 
Join Date: Jan 2012
Posts: 557
Default

Me either, not much time.
All I'm looking for is to get tatts the same as I get it in VBA web query for starters.

The Loop thing in .py, ( don't take my word for it though ), I think it has to do with "for" in the code.

Here is an example it shows on the lesson of Loops ( names changed to be
relevant)

Code:
MCupWinners = ['1996_saintly', '2005_makybediva', '1930_pharlap'] for MCupWinners in MCupWinners: print(MCupWinners)


it will show as

1996_saintly
2005_makybediva
1930_pharlap


The for bit is Loop.

What I want is Loop and Refresh from web page to txt, or direct destination to Excel Sheet. Iv'e seen codes, but they do weather updates and flight times etc.... The lesson are not generic, or specific it seems.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump



All times are GMT +10. The time now is 10:06 AM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
2008 OZmium Pty. Ltd. All rights reserved . ACN 091184655