Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Pozivanje iz funkcije

[es] :: Python :: Pozivanje iz funkcije

[ Pregleda: 2617 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

MarkoBalkan

Član broj: 141124
Poruke: 1624
*.adsl.net.t-com.hr.



+19 Profil

icon Pozivanje iz funkcije26.08.2007. u 13:16 - pre 201 meseci

import math
a=input(int)
b=input(int)
c=input(int)


def jed():
b*b-4*a*c
if b*b-4*a*c<0:
math.sqrt(math.sqrt((b*b-4*a*c)*(b*b-4*a*c)))*(-1)
return math.sqrt(math.sqrt((b*b-4*a*c)*(b*b-4*a*c)))*(-1)
else:
math.sqrt(b*b-4*a*c)
return math.sqrt(b*b-4*a*c)



jed()
if b*b-4*a*c<0:
print math.sqrt(math.sqrt((b*b-4*a*c)*(b*b-4*a*c)))*(-1)
else:
print math.sqrt(b*b-4*a*c)



ovo je kod koji racuna vrijednost determinante kod kvadratne jednadzbe.
kako zamijeniti "b*b-4*a*c" sa varijablom d?
umjesto math.sqrt(math.sqrt((b*b-4*a*c)*(b*b-4*a*c)))*(-1) i math.sqrt(b*b-4*a*c) da vrati za svaki dio jednu varijablu?
 
Odgovor na temu

StefanJer91
Stefan Jeremic
Beograd

Član broj: 121923
Poruke: 160
*.mainstream.co.yu.



Profil

icon Re: Pozivanje iz funkcije26.08.2007. u 14:00 - pre 201 meseci
stavis samo d= b*b-4*a*c
The earth teaches us more about ourselves than all the books. Because it resists us. Man discovers himself when he measures himself against the obstacle.
 
Odgovor na temu

MarkoBalkan

Član broj: 141124
Poruke: 1624
*.adsl.net.t-com.hr.



+19 Profil

icon Re: Pozivanje iz funkcije26.08.2007. u 14:49 - pre 201 meseci
javi gresku?
jel treba varijablu d incijalizirati?
a umjesto kobasica da stavim varijablu?
kad stavim neku varijablu, javi gresku.
 
Odgovor na temu

StefanJer91
Stefan Jeremic
Beograd

Član broj: 121923
Poruke: 160
*.mainstream.co.yu.



Profil

icon Re: Pozivanje iz funkcije26.08.2007. u 15:10 - pre 201 meseci
Ne stavljas odmah direktno, vec u funkciji jed()
The earth teaches us more about ourselves than all the books. Because it resists us. Man discovers himself when he measures himself against the obstacle.
 
Odgovor na temu

MarkoBalkan

Član broj: 141124
Poruke: 1624
*.adsl.net.t-com.hr.



+19 Profil

icon Re: Pozivanje iz funkcije26.08.2007. u 15:17 - pre 201 meseci
daj pokazi kak se to radi.
 
Odgovor na temu

StefanJer91
Stefan Jeremic
Beograd

Član broj: 121923
Poruke: 160
*.mainstream.co.yu.



Profil

icon Re: Pozivanje iz funkcije26.08.2007. u 23:26 - pre 201 meseci
prost primer:
Code:


import math
a = input('Unesi broj: ')
b = input('Unesi 2 broj: ')

def pitagorina_teorema():
    d = a**2+b**2
    return math.sqrt(d)

print pitagorina_teorema()

The earth teaches us more about ourselves than all the books. Because it resists us. Man discovers himself when he measures himself against the obstacle.
 
Odgovor na temu

[es] :: Python :: Pozivanje iz funkcije

[ Pregleda: 2617 | Odgovora: 5 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.