Σήμερα στο μάθημα μιλήσαμε για κοινωνικά δίκτυα.
Δώσαμε έμφαση στο προφιλ και στο πως το προστατεύουμε με έναν ισχυρό κωδικό.
Μερικές σημειώσεις από το μάθημα:
Επίσης έχουμε μία παλιότερη άσκηση, όποιος θέλει μπορεί να την δει, εδώ είναι.
Σήμερα στο μάθημα μιλήσαμε για κοινωνικά δίκτυα.
Δώσαμε έμφαση στο προφιλ και στο πως το προστατεύουμε με έναν ισχυρό κωδικό.
Μερικές σημειώσεις από το μάθημα:
Επίσης έχουμε μία παλιότερη άσκηση, όποιος θέλει μπορεί να την δει, εδώ είναι.
Οι ασκήσεις μας για την επόμενη φορά θα είναι η 9, 10 και η 11 από το δευτερο φυλλάδιο.
Ασκήσεις 5ο Κεφάλαιο Εργαστήριο 2o set
Μην ξεχάσετε το τέστ που θα γράψουμε.
Από το 5ο κεφάλαιο (να μάθετε πολύ καλά τον αλγόριθμο δυαδικής αναζήτησης (σελίδα 71) και τον αλγόριθμο ταξινόμησης ευθείας ανταλλαγής (σελίδα 77).
Για αύριο δείτε την άσκηση 4 από το 2ο σετ.
ΒΠ – ΛΣ – Συντήρηση Λειτουργικού συστήματος
Μην ξεχάσετε για αύριο:
Καλό διάβασμα!
Από το 2ο σετ έχουμε για αύριο την άσκηση 1:
# -*- coding: cp1253 -*-
#10.py πρώτο set
def einai_ayksousa( l ):
for i in range( len(l)-1 ):
if l[i] > l[i+1]:
return False
return True
def vres( key, lista ):
if einai_ayksousa( lista ) == False:
print "Prosoxh h lista den einai se ayksoysa seira"
return -1
first, last = 0, len(lista) - 1
found, thesi = False, -1
while first <= last and not found :
thesi = ( first + last ) / 2
if lista[ thesi ] == key :
found = True
elif lista[ thesi ] l[i+1]:
return False
return True
def vres( key, lista ):
if einai_ayksousa( lista ) == False:
print "Prosoxh h lista den einai se ayksoysa seira"
return []
first, last = 0, len(lista) - 1
found, thesi = False, -1
while first <= last and not found :
thesi = ( first + last ) / 2
if lista[ thesi ] == key :
found = True
elif lista[ thesi ] l[i+1]:
return False
return True
def vres( key, lista ):
if einai_ayksousa( lista ) == False:
print "Prosoxh h lista den einai se ayksoysa seira"
return []
first, last = 0, len(lista) - 1
found, thesi = False, -1
while first <= last and not found :
thesi = ( first + last ) / 2
if lista[ thesi ] == key :
found = True
elif lista[ thesi ] < key :
first = thesi + 1
else :
last = thesi - 1
if found:
theseis = []
for i in range( len(lista) ):
if lista[i] == key :
theseis.append( i )
return theseis #an to vrike
else:
return []
dokimi = ["apple", "bar", "code", "diamond", "echo", "eat", "friend"]
print vres( "echo", dokimi)
# -*- coding: cp1253 -*-
#14.py πρώτο set
def antimetathesi( a, b ):
return b, a
a = raw_input("Dwse to A:")
b = raw_input("Dwse to B:")
a,b = antimetathesi(a, b)
print a
print b
Από το πρώτο σετ δείτε τις ασκήσεις 10 έως και 13.
Επανάληψη το 5ο κεφάλαιο (να μάθετε πολύ καλά τον αλγόριθμο δυαδικής αναζήτησης (σελίδα 71) και τον αλγόριθμο ταξινόμησης ευθείας ανταλλαγής (σελίδα 77).
Η λύση για τις ασκήσεις 2,3 και 4 είναι:
import random
apo = input("Dwse katw orio:")
mexri = input("Dwse panw orio:")
secret = random.randint(apo,mexri)
apantisi, tries = "", 10
while apantisi != secret and tries > 0:
print "Poios nomizeis oti einai o mystikow arithmos;"
print "prospatheia : ", tries
apantisi = input("Einai o :")
if apantisi>secret:
print "Lypamai einai mikroteros"
elif apantisi < secret:
print "Lypamai einai megaliteros"
tries -= 1 #tries = tries - 1
if apantisi == secret :
print "Mprabo to vrikes"
elif tries>0:
print "Oxi prospathise ksana"
Η λύση για την 5, 6 και 7 είναι:
apo = input("Dwse to A:")
mexri = input("Dwse to B:")
while apo>mexri:
print "Dwse oria ksana"
apo = input("Dwse to A:")
mexri = input("Dwse to B:")
apantisi = "n"
tries = 0
while apantisi != "y" :
arithmo = (apo + mexri) / 2
print "Einai to ", arithmo, "?"
apantisi = raw_input("y/n:")
tries += 1
if apantisi == "n":
megaliteros = raw_input("Einai Megalyteros ? (y/n):")
if megaliteros == "y":
apo = arithmo + 1
else:
mexri = arithmo - 1
print "Xreiastikes", tries, "prospathies"
Για την 8:
# -*- coding: cp1253 -*-
#8.py πρώτο set
#l[0] < l[1] < l[2] <
#κάθε στοιχείο πρέπει να ειναι μικρότερο από το επόμενο
#έστω και μία θέση να βρω που να μην ισχύει αυτό
#πρέπει να κάνω return False
#l = [x,z,f]
def einai_ayksousa( l ):
for i in range( len(l)-1 ):
if l[i] > l[i+1]:
return False
return True
Για την 9:
# -*- coding: cp1253 -*-
#9.py πρώτο set
def vres( key, lista ):
first, last = 0, len(lista) – 1
found, thesi = False, -1
while first <= last and not found :
thesi = ( first + last ) / 2
if lista[ thesi ] == key :
found = True
elif lista[ thesi ] < key :
first = thesi + 1
else :
last = thesi – 1
if found:
return thesi #an to vrike
else:
return -1
Και προσχέδιο για την 10:
# -*- coding: cp1253 -*-
#10.py πρώτο set
def einai_ayksousa( l ):
for i in range( len(l)-1 ):
if l[i] > l[i+1]:
return False
return True
def vres( key, lista ):
#…einai_ayksousa()…
#if ….
first, last = 0, len(lista) – 1
found, thesi = False, -1
while first <= last and not found :
thesi = ( first + last ) / 2
if lista[ thesi ] == key :
found = True
elif lista[ thesi ] < key :
first = thesi + 1
else :
last = thesi – 1
if found:
return thesi #an to vrike
else:
return -1
Δείτε το 1ο βίντεο και απαντήστε στις ερωτήσεις του Quiz.
https://video.link/w/oBPGb [yt]
Δείτε και το 2ο βίντεο και προετοιμαστείτε για ερωτήσεις στο επόμενο μάθημα!