Entropia:Sandkasten: Unterschied zwischen den Versionen

aus dem Wiki des Entropia e.V., CCC Karlsruhe
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 45: Zeile 45:
[[Kategorie:Wiiwle]]
[[Kategorie:Wiiwle]]


<syntaxhighlight lang="php">
<syntaxhighlight lang="python">
<?php
from time import localtime
    $v = "string";    // sample initialization
 
?>
activities = {8: 'Sleeping',
html text
              9: 'Commuting',
<?
              17: 'Working',
    echo $v;         // end of php code
              18: 'Commuting',
?>
              20: 'Eating',
              22: 'Resting' }
 
time_now = localtime()
hour = time_now.tm_hour
 
for activity_time in sorted(activities.keys()):
    if hour < activity_time:
        print activities[activity_time]
         break
else:
    print 'Unknown, AFK or sleeping!'
</syntaxhighlight>
</syntaxhighlight>

Version vom 28. Juni 2012, 16:10 Uhr


dienstags donnerstags mittwochs
jack ja nein
laus ja ja
neingeist n n ja
sum(ja) 1 1 2
from time import localtime

activities = {8: 'Sleeping',
              9: 'Commuting',
              17: 'Working',
              18: 'Commuting',
              20: 'Eating',
              22: 'Resting' }

time_now = localtime()
hour = time_now.tm_hour

for activity_time in sorted(activities.keys()):
    if hour < activity_time:
        print activities[activity_time]
        break
else:
    print 'Unknown, AFK or sleeping!'