Problem 1
-
Lets meet sara
-
Sara knows how to add, subtract
- Sample conversations
Hi Sara
Add 5 and 6
- You have make her multiply two numbers
- Make sara multiply 6 * 3
Hi Sara
Add 6 and 6 and 6
- Sara knows addition (+), subtraction(-) , division (//), multiplication (*), modulus (%) ,assignment =
5 // 2 => 2
5 % 2 => 1
- Sara executes your instructions line by line, Sara remembers results by giving alias names
Remember 10 as a
say a
a = 10
say a
Problem 2
- Lets make sara calculate simple intrest
- Conversation
Remember 100000 as P
Remember 24 as R
Remember 3 as T
Calcuate P * T * R // 100
Problem 3
- Sara learn about
- less than
<
- less than or equal to
<=
- equal
==
- greater than
>
- greater than or equal to
>=
- or
a == 5 or a >= 0
- and
- not
- Example
Remember 1 as index
say index
index = index + 1
until index < 5 go to line 2
Project Euler 1
Hi Sara
start = 1
max = 10
result = 0
until start < max repeat
if start % 3 == 0 or start % 5 == 0
result = result + start
start = start + 1
end
say result
Like this:
Like Loading...