ciao a tutti,
volevo chiedervi che comando si usa per fare in modo che un programma ricominci da capo. cioe fare in modo che dopo che finisca si restarti automaticamente.
grazie.
ciao a tutti,
volevo chiedervi che comando si usa per fare in modo che un programma ricominci da capo. cioe fare in modo che dopo che finisca si restarti automaticamente.
grazie.
Niente link a siti hentai nella firma.
richiamare la funziona principale alla fine? o_o
Sono masto. Gaio chi nega.
come?
Niente link a siti hentai nella firma.
forse nn sono stato abbastanza chiaro....
sono estremamente noob.
Niente link a siti hentai nella firma.
Fai un ciclo infinito.
O fai un while che dice di uscire solo se l'utente dà un determinato input.
Se spieghi meglio la natura del programma in questione è più facile consigliarti...
He who is not bold enough to be stared at from across the abyss
is not bold enough to stare into it himself.
ok ecco
ok diciamo che io voglia fare in modo che finche l'utente nn sceglie l'opzione quit il programma continui a ripetersi, cosa devo fare??Codice:print "welcome to the area calculation program By: Kareem kamel" print "----------------------------------------------------------" print """ plz choose a shape: 1- for triangle 2- for circle 3- for square or press 4 to quit """ shape= raw_input("plz select the shape u desire: ") if shape== "1": base=input("plz eneter the triangle's base lenght") height=input("plz enter the triangle's height") area= (base*height)/2 print "the triangle's area is equale to:", area elif shape== "2": radius=input("plz enter the radius:") area= 3.14189*radius*radius print "the circle's area is equal to:",area elif shape=="3": side=input("what's the square's side lenght?") area= side**2 print"the square's side lenght is equal to", area elif shape=="4": import sys sys.exit() else: print " this aint no valid comand U idiot"
Niente link a siti hentai nella firma.
PS: ci potrebbe essere un errore nel modulo sys se qualcuno potrebbe corregierlo mi farebbe un piacere.
Niente link a siti hentai nella firma.
avrei un altra domanda.
nn ho ancora capito a che cosa serve la funzione "return".
perfavore spiegatemi!!!!
Niente link a siti hentai nella firma.
scusate tanto ma mentre ci sono vorrei che mi spiegaste come questi due moduli funzionano:
Codice:# a day value of -1 => today def dayOfWeek(DayNum = -1): days = ['Monday','Tuesday', 'Wednesday','Thursday', 'Friday', 'Saturday', 'Sunday'] # check for the default value if DayNum == -1: # Use the time module functions to get current time # see the table above and the official module documentation import time theTime = time.localtime(time.time()) DayNum = theTime[6] return days[DayNum]in dettagli plz!!Codice:def numwords(s): list = split(s) # list with each element a word return len(list) # return number of elements in list for line in file: total = total + numwords(line) # accumulate totals for each line print "File had %d words" % total
grazie!
Niente link a siti hentai nella firma.
Il problema non era nel sys, ma nell'indentazione........Codice:print "welcome to the area calculation program By: Kareem kamel" print "----------------------------------------------------------" print """ plz choose a shape: 1- for triangle 2- for circle 3- for square or press 4 to quit """ while (1): shape= raw_input("plz select the shape u desire: ") if shape== "1": base=input("plz eneter the triangle's base lenght") height=input("plz enter the triangle's height") area= (base*height)/2 print "the triangle's area is equale to:", area elif shape== "2": radius=input("plz enter the radius:") area= 3.14189*radius*radius print "the circle's area is equal to:",area elif shape=="3": side=input("what's the square's side lenght?") area= side**2 print"the square's side lenght is equal to", area elif shape=="4": break else: print " this aint no valid comand U idiot"
RETURN: Prima di capire a che cosa serve il return, sei sicuro di aver capito a come funziona una funzione??
MODULO: Quale modulo ???
ma per uscire dal programma nn si fa
import sys
sys.exit
??
si ho capito come funziona una funzione ma nn capisco che significato abbia il comando return???
e perfavore cercate di spiegarmi quei due esempi.
Niente link a siti hentai nella firma.
grazie per avere corretto il programma.Yubei
scusa ho sbaliata tra modulo e funzione
Niente link a siti hentai nella firma.
Il comando return assegna un valore a una funzione... non c'è granchè da capire. Cosa c'è di poco chiaro in questo esempio?tricky
He who is not bold enough to be stared at from across the abyss
is not bold enough to stare into it himself.
nn capisco mi dispiace...Phoenix
perfavore si piu chiaro.
aparte il fatto che nn so che linguaggio sia quello usato nel esempio.
allora diciamo cosa cambia quando fai return e quando non lo metti
mi dispiace abbiate un po di pazienza
Niente link a siti hentai nella firma.
uhm ok ho capito scusate la mia stupidita.
mi fareste un grandissimo piacere a spiegarmi i due esmpi grazie
Niente link a siti hentai nella firma.