P refiero anidar las lógicas en vez de hacer una tan larga... piensa en cuando tengas que depurar!!!
El 3 de abril de 2013 10:53, Ricardo Cárdenes <[email protected]>escribió: > Esto: > > si (a == 11 and b == 5) se cumple pasa y si (c == 3 or x == 8) se > cumple también pasa > > no es lo mismo que esto: > > if (a == 11 and b == 5) and (c == 3 or x == 8): > > al menos según yo lo leo. Lo que has implementado es: > > si se cumple que (a == 11) y (b == 5) y también que (c == 3 or x ==8) > entonces... > > Eso se puede escribir también: > > if a == 11 and b == 5 and (c == 3 or x == 8): > > Sin embargo lo que describiste es: > > if (a == 11 and b == 5) or c ==3 or x == 8: > > Tendrás que decidir qué es lo que realmente querías :D > > > 2013/4/3 Diego Uribe Gamez <[email protected]> > >> ya lo arregle: >> >> if (a == 11 and b == 5) and (c == 3 or x == 8): >> >> >> >> El 2 de abril de 2013 17:55, Diego Uribe Gamez < >> [email protected]> escribió: >> >> quiero evaluar dos condiciones y que si en alguno de los dos casos esta >>> sea cierta pasa, la cosa es que las condiciones tienen and o or, entonces >>> serian 4 condiciones, pero es que todo queda en una muy grande condición: >>> >>> if a == 11 and b == 5 and c == 3 or x == 8: ?? >>> >>> if (a == 11 and b == 5) (c == 3 or x == 8): !!esta mal!! >>> >>> como deberia hacer esto? >>> >>> si (a == 11 and b == 5) se cumple pasa y si (c == 3 or x == 8) se >>> cumple también pasa. >>> >>> -- >>> *Diego Alonso Uribe Gamez* >>> ------------------------------ >>> >>> *Desarrollador web* >>> >>> Twitter: @DiegoUG <http://www.twitter.com/DiegoUG> >>> >>> Google+: http://gplus.to/diegoug >>> ------------------------------ >>> >>> >> >> >> -- >> *Diego Alonso Uribe Gamez* >> ------------------------------ >> >> *Desarrollador web* >> >> Twitter: @DiegoUG <http://www.twitter.com/DiegoUG> >> >> Google+: http://gplus.to/diegoug >> ------------------------------ >> >> >> _______________________________________________ >> Python-es mailing list >> [email protected] >> http://mail.python.org/mailman/listinfo/python-es >> FAQ: http://python-es-faq.wikidot.com/ >> >> > > _______________________________________________ > Python-es mailing list > [email protected] > http://mail.python.org/mailman/listinfo/python-es > FAQ: http://python-es-faq.wikidot.com/ > > -- *monoBOT* Visite mi sitio(Visit my site): monobotblog.alvarezalonso.es
_______________________________________________ Python-es mailing list [email protected] http://mail.python.org/mailman/listinfo/python-es FAQ: http://python-es-faq.wikidot.com/
