Skip to content

Commands

Sumant Bhaskaruni edited this page Jul 9, 2017 · 11 revisions

The items popped are listed in the order they are popped.

  • x, y, z stand for any kind of value (unless the operation is not suitable for it).
  • num stands for any kind of number (integer or float).
  • int stands for an integer.
  • float stands for a float.
  • str stands for a string.
  • char stands for a string of length 1.
Command Items popped Description
+ num1, num2
str1, str2
push num2 + num1
push the concatenation of str2 and str1
- num1, num2 push num2 - num1
× num1, num2
str, int or int, str
push num2 * num1
push str repeated int times.
÷ num1, num2 push num2 / num1
% num1, num2
x, str
push num2 % num1
push str formatted with x (using Python's % formatting)
* num1, num2 push num2 ^ num1 (exponentiation)
num push the square root of num
x print x
x do nothing
¬ x push the negation of x (logical NOT)
x, y push y and x (logical AND)
x, y push y or x (logical OR)
i x convert x to an integer and push it
f x convert x to a float and push it
s x convert x to a string and push it
c int convert int to its ASCII character and push it
o char convert char to its ASCII number and push it
str, int push str[int:]
str, int push str[:int]
str, int push str[::int]
& int1, int2 push int2 & int1 (bitwise AND)
| int1, int2 push int2 | int1 (bitwise OR)
^ int1, int2 push int2 ^ int1 (bitwise XOR)
~ int push ~ int (bitwise NOT)
« int1, int2 push int2 << int1 (bit left shift)
» int1, int2 push int2 >> int1 (bit right shift)
: x push x twice
< x, y push y < x
> x, y push y > x
= x, y push y == x
x, y push y <= x
x, y push y >= x
± num push 1 if num is positive, 0 if num equals 0 or -1 if num is negative
| num push the absolute value of num
p num push whether num is prime
x, y push x and push y
reverse the stack
x push x to the bottom of the stack
x from the bottom push x
whole stack push the minimum element of the stack
whole stack push the maximum element of the stack
# whole stack push the sum of the elements of the stack
whole stack push the product of the elements of the stack
Clone this wiki locally