Anonymní profil Honza – Programujte.com
 x   TIP: Přetáhni ikonu na hlavní panel pro připnutí webu

Anonymní profil Honza – Programujte.comAnonymní profil Honza – Programujte.com

 

Příspěvky odeslané z IP adresy 37.188.239.–

Honza
Python › python-obrazek
5. 11. 2012   #165942

#3 Honza
jooooo uz to mam ...dekuji TI ...mas pravdu... Byla to jen zalezitost sys.stdout.write('\n') jak jsi napsal a spravneho potukani na tabelator...

posilam skript:

import os
import math
import sys
import numpy as np


for x in np.arange (-1,1,2.0/37.0):
    for y in np.arange (-1,1+2.0/73.0,2.0/73.0):
            h=(64*x**8)-(128*x**6)+(16*y**6)+(80*x**4)-(24*y**4)-(16*x**2)+(9*y**2)

            if h<0:
               sys.stdout.write('-')
            elif h>=0:
               sys.stdout.write('+')


    sys.stdout.write('\n')

dekuji mnohokrat

Honza
Python › python-obrazek
5. 11. 2012   #165941

dik za odpoved ale to nebude to prave orechove...zkusil jsem to v ruznych kombinacich a nefunguje to

Honza
Python › Rozpiklení binárního souboru
5. 11. 2012   #165937

#1 Luki
Cau 

a co zkusit ten soubor prilozit?

Honza
Python › python-obrazek
5. 11. 2012   #165936

ahoj vsem

zkousim naprogramovat funkci:

h=(64*x**8)-(128*x**6)+(16*y**6)+(80*x**4)-(24*y**4)-(16*x**2)+(9*y**2)

kde x je z intervalu <-1,1> a y=<-1,1>. Jde o to ze vypisem programu by mel byt obrazek ktery bude obsahovat 37 radku a v kazdem radku bude 73 znaku. Ty znaky jsou + a -. Kdyz vyjde funkce h dosazeni za x  a y z daneho intervalu zaporna vytiskne se - a kdyz vyjde 0 nebo kladna tak plus...

tady je kdyz tak ten vystup-obrazek

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+-------+++++++----------------+++++++++++----------------+++++++-------+
+---------++-----------------------+++-----------------------++---------+
+---------++-----------------------+++-----------------------++---------+
+-------++++++------------------+++++++++------------------++++++-------+
+------+++++++++--------------+++++++++++++--------------+++++++++------+
++----++++++++++++----------+++++++++++++++++----------++++++++++++----++
++---++++++++++++++-------+++++++++++++++++++++-------++++++++++++++---++
+++-+++++++++++++++++---+++++++++++++++++++++++++---+++++++++++++++++-+++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++-+++++++++++++++++---+++++++++++++++++++++++++---+++++++++++++++++-+++
++---+++++++++++++++------+++++++++++++++++++++------+++++++++++++++---++
++---+++++++++++++---------+++++++++++++++++++---------+++++++++++++---++
+-----+++++++++++------------+++++++++++++++------------+++++++++++-----+
+------+++++++++--------------+++++++++++++--------------+++++++++------+
+-------++++++------------------+++++++++------------------++++++-------+
+--------++++--------------------+++++++--------------------++++--------+
+---------++-----------------------+++-----------------------++---------+
+-----------------------------------+-----------------------------------+
+---------++-----------------------+++-----------------------++---------+
+--------++++--------------------+++++++--------------------++++--------+
+-------++++++------------------+++++++++------------------++++++-------+
+------+++++++++--------------+++++++++++++--------------+++++++++------+
+-----+++++++++++------------+++++++++++++++------------+++++++++++-----+
++---+++++++++++++---------+++++++++++++++++++---------+++++++++++++---++
++---+++++++++++++++------+++++++++++++++++++++------+++++++++++++++---++
+++-+++++++++++++++++---+++++++++++++++++++++++++---+++++++++++++++++-+++
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++-+++++++++++++++++---+++++++++++++++++++++++++---+++++++++++++++++-+++
++---++++++++++++++-------+++++++++++++++++++++-------++++++++++++++---++
++----++++++++++++----------+++++++++++++++++----------++++++++++++----++
+------+++++++++--------------+++++++++++++--------------+++++++++------+
+-------++++++------------------+++++++++------------------++++++-------+
+---------++-----------------------+++-----------------------++---------+
+---------++-----------------------+++-----------------------++---------+
+-------+++++++----------------+++++++++++----------------+++++++-------+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

muj navrh je tento:

import os
import math
import sys
import numpy as np


for x in np.arange (-1,1,2.0/37.0):
    for y in np.arange (-1,1,2.0/73.0):  
        h=(64*x**8)-(128*x**6)+(16*y**6)+(80*x**4)-(24*y**4)-(16*x**2)+(9*y**2)

        if h<0:
           sys.stdout.write('-')
        elif h>=0:
           sys.stdout.write('+')

ten modul np.arange umoznuje rodelit interval tedy muj <-1,1> pomoci desetinneho cisla 2.0/37.0

kdyz ten skrip spustim tak se mi zacnou vypisovat + a - ....ale problem je v tom ze po 73 znacich v radku to pokracuje dal coz nechci...chtel bych aby po 73 znacich to preskocilo na dalsi radku...

ma nekdo nejake reseni? dekuji za odpovedi

 

 

Hostujeme u Českého hostingu       ISSN 1801-1586       ⇡ Nahoru Webtea.cz logo © 20032024 Programujte.com
Zasadilo a pěstuje Webtea.cz, šéfredaktor Lukáš Churý