|
Construct |
Python |
Java |
|
Primitive |
boolean, int, double |
boolean, int, double |
|
Reference |
str |
String |
|
Variables |
a = 3 |
int a = 3; |
|
Arithmetic |
a = 3 + 4 * 5 |
a = 3 + 4 * 5; |
|
Binary |
(a or b) and not c |
(a || b) && !c |
|
String |
c = “hello” + ' there' |
String c = “hello” + “ there”; |
|
Blocks |
indentation |
{ |
|
Conditional |
if a < b: |
if (a < b) { |
|
Construct |
Python |
Java |
|
For loops |
for i in range(0, 4): |
for (int i = 0; i < 5;
i++) { |
|
While loops |
a = 0 |
int a = 0; |
|
Arrays |
a = [1, 1, 2, 3, 5, 8] |
int[] a = {1, 1, 2, 3, 5, 8}; |
|
Method |
obj.method() |
obj.method(); |
|
Comments |
# single line comment |
// single line comment |