Python
Schreibe in den nachfolgenden Editor
a = 5
b = 6
if a < b:
print("a ist tatsächlich kleiner als b"))
elif a > b:
print(b/a)
else:
print(round(a/b,2))
and run the script.
Aber schön der Reihe nach:
first:
You have to enable shell_exec() from your server
second:
Write the following Script in a .py-file within a folder named py
a = 4.5413 b = 5.4579 if a > b: print(round(a/b,3)) else: print(round(b/a,3))
third:
Write the following Script in a .php-file
<?php
echo shell_exec("python python/py/index.py");
?>
Das Resultat lautet: 3.691
While
Write each of the the following Scripts in a separate .py-file within a folder named py
i = 1
while i < 6:
print(i)
i += 1
i = 1
while i < 6:
print(i)
if (i == 3):
break
i += 1
i = 0
while i < 6:
i += 1
if i == 3:
continue
print(i)
i = 0
while i < 10:
i += 1
if 6 <= i <= 7:
continue
print(i)
i = 1
while i < 6:
print(i)
i += 1
else:
print("i is no longer less than 6")
third:
Write the following Script in the corresponding .php-files
<?php
echo shell_exec("python python/py/while.py");
?>
Result while if <= i <=x continue:
1
2
3
4
5
8
9
10
(note that number 6 and 7 are missing in the result)