Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
question about loops
#4
(Nov-05-2022, 08:03 AM)rpang Wrote: thank you so much appreciated !!!! :) makes sense
def Q9(n): # n is an arbitrary variable name
    for i in range(n):
        print(i)
Q9(9)
looks like this code print the answer twice? is it because of the print(i) print a separate set of numbers?
Yoriz write Nov-05-2022, 08:34 AM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
question about loops - by rpang - Nov-05-2022, 07:19 AM
RE: question about loops - by rob101 - Nov-05-2022, 07:58 AM
RE: question about loops - by rpang - Nov-05-2022, 08:03 AM
RE: question about loops - by rpang - Nov-05-2022, 08:25 AM
RE: question about loops - by rob101 - Nov-05-2022, 08:31 AM
RE: question about loops - by rpang - Nov-05-2022, 11:11 PM
RE: question about loops - by rob101 - Nov-05-2022, 11:47 PM
RE: question about loops - by deanhystad - Nov-07-2022, 09:42 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Homework help:While Loops question Midhat_School 6 3,261 Jul-26-2020, 10:23 AM
Last Post: pyzyx3qwerty

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020