Differences between Python 、
FORTRAN and C
Operation |
Python |
FORTRAN |
C |
Computation of the logarithm base 10 of the input value with missing value management |
log10() |
LOG10() |
log() |
Computation of 10 raised to the power of the input value |
exp10() or pow10() |
POW(10, ) |
pow(10,) |
Computation of input value1 raised to the power of the input value2 |
** (example: 10 ** 3) or pow(10, 3) |
** (example: 10 ** 3) or POW(10, 3) |
pow(10,3) |
Missing value (-9999) |
MissingValue |
-9999 |
MISSING_VALUE |
Conditions |
if perm <= 0 or permMin == MissingValue: x = MissingValue elif perm > 1000: x = MissingValue else: x = log10(perm) y = log10(perm) - permMin |
IF ((perm.LE.(0)).AND.(permMin.EQ.( -9999)) THEN x = -9999 ELSE IF (perm.GT.(1000)) THEN x = -9999 ELSE x = LOG10(perm) y = LOG10(perm) - permMin ENDIF |
if (perm<=0|| permMin == MissingValue) { x = MissingValue; } else if (perm > 1000) { x = MissingValue; } else { x = log10(perm); y = log10(perm) – permMin; }
|
Logical operator - or |
or |
.OR. |
|| |
Logical operator - and |
and |
.AND. |
&& |
Logical operator - not |
not |
.NOT. |
! |
Comparison operator - equal |
== |
.EQ. |
== |
Comparison operator - different |
!= or <> |
.NE. |
!= |
Other similar comparison operators |
<, <=, >, >=, (...) |
.LT., .LE., .GT., .GE., ... |
<, <=, >, >= |
Assignment operators |
=,+=, -=, *=, /= |
|
=,+=, -=, *=, /= |
Temporary "variable" creation |
a = 10 |
REAL|INTEGER a a = 10 |
int a =10; |
Temporary "list" creation, append operation and display |
a = [] a.append("Well1") print a |
|
char a[10]; a="Well1"; printf(“%s”,a); |
Output display |
output("Hello world!") or print "Hello world!" |
PRINT 'Hello world!' |
printf("Hello world!"); |
Loop |
for i in range(i1, i2, inc): |
DO i = i1, i2, inc END DO |
for (i=i1;i<i2;i=i+inc){} while(i<i2){i=i+inc;}
|
Comment |
#{comment until the end of the line} |
C in the first column |
//{in the first column}
/*…….*/{comment during the two symbols} |