code issue

Chris Angelico rosuav at gmail.com
Thu Apr 21 14:20:16 EDT 2022


On Fri, 22 Apr 2022 at 04:19, Jack Dangler <tdldev at gmail.com> wrote:
>
>
> On 4/21/22 13:09, Chris Angelico wrote:
> > On Fri, 22 Apr 2022 at 03:02, Tola Oj <ojomooluwatolami675 at gmail.com> wrote:
> >> for i in range(1, n+1):
> >>          if i % 3 == 0 and i % 5 == 0:
> >>              print("Fizzbuzz")
> >>          elif i % 3 == 0:
> >>              print("Fizz")
> >>          elif i % 5 == 0:
> >>              print("Buzz")
> >>          else:
> >>              print(i)
> >>      print(i, sep='\n')
> >>
> >> fizzbuzz(13)
> > This can't be your complete code, because it won't run like this. Have
> > a very careful read through of your code, and consider adding some
> > extra print statements to see what's happening; but if you're asking
> > for help, you'll definitely need to post the entire program.
> >
> > ChrisA
> fizzbuzz is one of Angela Yu's lab assignments in her py course.If you
> ask her, she'll gladly tell you where you are going wrong and even
> supply an entirely correct version, if you want it...

Fizz Buzz is a very common assignment. The point isn't to get a
correct version, the point is to understand what it's doing :)

ChrisA


More information about the Python-list mailing list