Page 1 of 2
Getting Snakey
Posted: Sat Feb 15, 2020 2:16 pm
by richmond62
-
I bought this in an airport bookshop . . . possibly the easiest, simplest intro I have seen for 12 Euros.
Re: Getting Snakey
Posted: Sat Feb 15, 2020 2:19 pm
by richmond62
So . . . I am getting started with Python because market forces are pushing me that way
(fancy way of saying that parents here in Bulgaria have been asking if I can teach an "Intro to Python" course
for kiddos this summer: now I no longer have to lie.

)
From a personal point of view it is not a bad thing to look at Python as it throws up questions
about LiveCode . . .
Re: Getting Snakey
Posted: Sat Feb 15, 2020 2:33 pm
by bogs
What... no assembly ?

Re: Getting Snakey
Posted: Sat Feb 15, 2020 2:35 pm
by richmond62
So; here we go . . .
-

- pq1.png (12.4 KiB) Viewed 8893 times
-
but I am not sure how to get non-floating point result in LiveCode.
Re: Getting Snakey
Posted: Sat Feb 15, 2020 2:42 pm
by bogs
Hm. Not sure, but do you mean this?

- It 'remains' to be seen...
Re: Getting Snakey
Posted: Sat Feb 15, 2020 2:45 pm
by richmond62
No:
I mean this:
99 / 2 = 49
Re: Getting Snakey
Posted: Sat Feb 15, 2020 2:55 pm
by richmond62
What is the point of this?
-

- pq2.png (6.43 KiB) Viewed 8883 times
Re: Getting Snakey
Posted: Sat Feb 15, 2020 2:58 pm
by bogs
I'm sorry, I have no idea what you are talking about.
Re: Getting Snakey
Posted: Sat Feb 15, 2020 3:02 pm
by richmond62
What... no assembly ?
Ouch . . . did some
Assembly in 1984, and it was, frankly, pretty Orwellian!
Round these parts (Bulgaria) the voices I hear in my he
ad are whispering "C++", "C#", "Java script" and "Python."
Interestingly enough no-one seems to be teaching
Python; so, at the risk of slipping on a banana-skin I'm attempting
to fill a niche.
Frankly, in spit of the very, very clear Black Dog Magazine the whole thing feels like the
PASCAL 5 I studied in 1984 . . .
retro and completely 'anal' about formatting, indenting and so on.
But, whatever my personal objections it is rather nice to open the fridge and find food there.

Re: Getting Snakey
Posted: Sat Feb 15, 2020 3:04 pm
by richmond62
I'm sorry, I have no idea what you are talking about.
Oh, well, that isn't the first time . . .

Re: Getting Snakey
Posted: Sat Feb 15, 2020 3:34 pm
by bogs
Well, I like playing with assembly, since it was the first language I messed with. As long as you kept things moving smoothly through the registers, it all came out ok.
I also like Pascal (and Delphi) which came after it, I thought Borland did a fantastic job with it, and there were no surprises with how things worked. Not sure how you consider Pascal to be anal about formatting, but I see a lot in common between Lc and Delphi, especially in the syntax.
I agree you should have food in the fridge as well, but what I'm not sure I understand is, you said - before you edited the post, which was after I replied - that you were unsure how to get a remainder in Lc from division. You then put some (what I assume are) examples using print in Python. I put an example of division with a remainder.
After you edited your post, it looks like your not looking for remainders, even though 99/2 would leave a '.5' remainder. So now I am unsure what exactly your trying to accomplish
The point of your last example, using .upper appears to be the equivalent of Lc's toUpper (also could use 'upper') function, turning lower case into upper case. However, since I know you already know that, I really don't get where your going. Were you mixing vodka with your orange juice this morning ?
Re: Getting Snakey
Posted: Sat Feb 15, 2020 5:13 pm
by richmond62
No Vodka this morning, nor, frankly this afternoon as I exist in a different time zone to thee.
Also: I do NOT drink Vodka; a drink that, presumably exists only for getting sloshed (after all it has very little taste) strikes
me as fairly foul.
I have never seen any value in something that changes everything to upper case or the other way round.
Re: Getting Snakey
Posted: Sat Feb 15, 2020 5:24 pm
by richmond62
as to this:-
-

- pq1.png (12.4 KiB) Viewed 8831 times
-
The first thing performs a floating-point division.
The second thing performs a a division that rounds DOWN to an integer.
The third thing performs a a division that rounds DOWN to an integer and then gives you the REMAINDER.
Now I know how to perform the first and the third operation, but not the second in LiveCode,
and as those operationsin Python are explained on "page 2" of that magazine (page 43).
.
Re: Getting Snakey
Posted: Sat Feb 15, 2020 5:45 pm
by bogs
richmond62 wrote: ↑Sat Feb 15, 2020 5:24 pm
Now I know how to perform the first and the third operation, but not the second in LiveCode,
The second in Lc is 'div', as in

- I thought something was dangling there...
- aPic_integerDivision.png (6.98 KiB) Viewed 8827 times
richmond62 wrote: ↑Sat Feb 15, 2020 5:13 pm
I have never seen any value in something that changes everything to upper case or the other way round.
The upper function changes what you specify (or not) to upper, handy if say, you chop a sentence in half, and want the first character recapitalized, you might use (psuedo code)
Code: Select all
put upper(char 1 of line 12 of field "newSentence")
Re: Getting Snakey
Posted: Sat Feb 15, 2020 6:18 pm
by richmond62
Thanks for
div, I have never come across that before.
