for a in range(1,3):
if a%2!=0:
print(a,end=" ")
for b in range(1,a+1):
if b%5==0:
print(b,end=" ")
for c in range(a,b+1):
if c%3!=0:
print(c,end=" ")
print()
def something(a):
for methodname in ['method1', 'method2', 'method3']:
try:
m = getattr(a, methodname)
except AttributeError:
pass
else:
return m()
raise AttributeError
//nested for
for (expr1; expr2; expr3) {
for (expr1; expr2; expr3) {
//statement;
}
}
// EXAMPLE
for ($i = 1; $i < 5; $i++) {
for ($j = 1; $j <= $i; $j++) {
echo " * ";
}
echo '<br />';
}
int inner;
string result = " ";
for (int outer = 0; outer < 3; outer++)
{
for (inner = 10; inner > 5; inner--)
{
result += string.Format("Outer: {0} Inner: {1}
", outer,
inner);
}
} MessageBox.Show(result);
}
[print(x, y) for x in iter1 for y in iter2]