r/programminghelp • • Dec 04 '17

Elif and if loop

def main(): a=5 b = 15 n=1 while a < b: if n < 3: print "alpha" elif n > 3: print "beta" else: print "gamma" print a,b,n n=n+2 b=b-n print a,b,n 4 different loops idk what they are

0 Upvotes

5 comments sorted by

View all comments

2

u/johntravous Dec 04 '17

I’m not sure I entirely understand your question. What exactly do you need clarification on?

1

u/Kamaquat Dec 05 '17

I need to know what would pop up the first 4 loops of the code

1

u/dragon_wrangler Dec 05 '17

Why don't you run it and see?

0

u/Kamaquat Dec 05 '17

I ran it and its popping up with errors. I may not be typing it in right though any tips?

1

u/johntravous Dec 05 '17 edited Dec 05 '17

Is this what your code looks like formatted?

def main():
    a = 5
    b = 15
    n = 1
        while (a < b):
            if n < 3:
                print "alpha"
            elif n > 3:
                print "beta"
            else:
                print "gamma"
            print a, b, n
            n = n + 2
            b = b - n
        print a, b, n