[ZADACI 1.] - Varijable i petlje

Koki007 nas uvodi u svijet Pythona i PyGamea!

Moderator: Danijel Korent

User avatar
SupermanRAA
Posts: 122
Joined: Tue Jan 26, 2010 1:19 am
Smallest prime number bigger than 20: 23

Re: [ZADACI 1.] - Varijable i petlje

Post by SupermanRAA » Thu Mar 11, 2010 11:08 pm

koki007 wrote:
SupermanRAA wrote:iako nikad nisam radio u phytonu i ni1 slovo od clanaka nisam procitao, prilicno sam siguran da bi zna rjesit ovaj 1b zadatak :D
Dokazi :p :zubo:
da znas da cu pokusat :D posaljem ti na pm kod pa ak nije gnjavaza sam odgovori ima li smisla :D
http://senselesspoet.blog.hr/ -> malo moe poezije :D

User avatar
dude
Posts: 415
Joined: Tue Feb 23, 2010 3:08 pm
Smallest prime number bigger than 20: 23

Re: [ZADACI 1.] - Varijable i petlje

Post by dude » Fri Mar 12, 2010 4:18 pm

koki007 wrote:
SupermanRAA wrote:iako nikad nisam radio u phytonu i ni1 slovo od clanaka nisam procitao, prilicno sam siguran da bi zna rjesit ovaj 1b zadatak :D
Dokazi :p :zubo:
Pa nisam niti ja. Evo dokaza.

User avatar
DIABLO III
Posts: 352
Joined: Wed May 06, 2009 4:19 pm
Smallest prime number bigger than 20: 23
Location: Croatia-krizevci

Re: [ZADACI 1.] - Varijable i petlje

Post by DIABLO III » Sat Mar 13, 2010 5:28 pm

nisi update-o da sam napravil zadatak :zubo:

User avatar
Danijel Korent
Romulanski špijun na Zemlji
Posts: 1583
Joined: Fri Sep 05, 2008 12:35 pm
Smallest prime number bigger than 20: 23
Location: Njemacka
Contact:

Re: [ZADACI 1.] - Varijable i petlje

Post by Danijel Korent » Sat Mar 13, 2010 5:33 pm

.. ups!! nepravda ispravljena :oops:
a.k.a. Koki

User avatar
Danijel Korent
Romulanski špijun na Zemlji
Posts: 1583
Joined: Fri Sep 05, 2008 12:35 pm
Smallest prime number bigger than 20: 23
Location: Njemacka
Contact:

Re: [ZADACI 1.] - Varijable i petlje

Post by Danijel Korent » Mon Mar 15, 2010 11:02 am

Evo rijesenja koja ste poslali, pa da vidite/raspravljate koliko ste razlicito ili slicno rijesili:


MaracKoMarac, zadatak 1.

Code: Select all

x=y=s=1
while True:
    if x>800 or y>800:
        s= -1
    if x<=0 or y<=0:
        s = 1
    x+= s
    y+= s
    print x,y

Mihael, zadatak 1.

Code: Select all

# varijable
x = 1
y = 1
s = 1

# beskonacna petlja
while True:
    # rad sa varijablama
    x += s
    y += s
   
    # ispis rezultata
    print x, y
   
    # provjera vrijednosti
    if x >= 800 or y >= 800:
        s = -1
    if x <= 0 or y <= 0:
        s = 1
Mihael, zadatak 1B

Code: Select all

# varijable koje cu koristiti
count = 1
x = 1

# petlja
while count >= 0:
    # ispis rezultata
    print count
    # provjera vrijednosti
    if count == 0:
        print "Kraj programa"

    # promjene na varijablama koje utjecu na petlju
    count = count + x

    # provjera vrijednosti
    if count >= 10:
        x = -x
OmegaApex, zadatak 1B

Code: Select all

x = 0
y = 10
s = 1

while x <= 10:
    x = x + s
    print x
    if x >= 10: break

while y >= 1:
    y = y - s
    print y
    if y == 1: break

print "Kraj programa"
loky4i4, zadatak 1B

Code: Select all

a =0
while a<10:
    a= a+1
    print a
while a >0:
    a =a-1
    print a
print "Kraj programa"
dude, zadatak 1B

Code: Select all

x = 1
s = 1

while x <= 10 and x > 0:
    print x

    if x >= 10:
        s = -1

    if x < 11:
        x += s


raw_input("\n\nPress the enter key to exit.")
Diablo III, zadatak 1B

Code: Select all

x=1
while x<10:
    print x 
    x+=1

while x>0:
      print x
      x-=1
a.k.a. Koki

User avatar
bytespiller
DB Contest Winner '09
Posts: 2328
Joined: Fri Sep 12, 2008 11:46 am

Re: [ZADACI 1.] - Varijable i petlje

Post by bytespiller » Mon Mar 15, 2010 4:50 pm

Ovo je baš super, vidjeti za istu stvar više različitih pristupa rješenju :pray: :tup: :tup: :tup:
Jedva čekam još vaših radova!

Po meni je to najurednije i najkvalitetnije riješio dude, a ovi koji su koristili po dvije petlje su se baš zgodno snašli meni to čak nebi ni palo na pamet :D

User avatar
dude
Posts: 415
Joined: Tue Feb 23, 2010 3:08 pm
Smallest prime number bigger than 20: 23

Re: [ZADACI 1.] - Varijable i petlje

Post by dude » Mon Mar 15, 2010 8:23 pm

bytespiller wrote:Ovo je baš super, vidjeti za istu stvar više različitih pristupa rješenju :pray: :tup: :tup: :tup:
Jedva čekam još vaših radova!

Po meni je to najurednije i najkvalitetnije riješio dude, a ovi koji su koristili po dvije petlje su se baš zgodno snašli meni to čak nebi ni palo na pamet :D
Thanks stvarno mi puno znači kada mi netko tako nešto kaže. To mi je onda velika inspiracija za daljni napredak.

User avatar
dude
Posts: 415
Joined: Tue Feb 23, 2010 3:08 pm
Smallest prime number bigger than 20: 23

Re: [ZADACI 1.] - Varijable i petlje

Post by dude » Mon Mar 15, 2010 8:26 pm

Čini mi se da večina več ima nekog iskustva iz pythona

User avatar
dude
Posts: 415
Joined: Tue Feb 23, 2010 3:08 pm
Smallest prime number bigger than 20: 23

Re: [ZADACI 1.] - Varijable i petlje

Post by dude » Wed Mar 17, 2010 8:34 pm

Kada če 4. članak

User avatar
Danijel Korent
Romulanski špijun na Zemlji
Posts: 1583
Joined: Fri Sep 05, 2008 12:35 pm
Smallest prime number bigger than 20: 23
Location: Njemacka
Contact:

Re: [ZADACI 1.] - Varijable i petlje

Post by Danijel Korent » Wed Mar 17, 2010 8:51 pm

dude wrote:Kada če 4. članak
Kad bude gotov
a.k.a. Koki

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest