Python Forum
I need help to solve this task using while statement
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help to solve this task using while statement
#4
Try using the following steps.

Within the function declare a variable k and check the condition within the while loop.

  k=1
  while(k<(n-1)): 
      .....step1
      .....step2
      k+=1

STEP1:
Using modulo operator check if the variable k is a multiple of n.
STEP2:Increment the value of k every time to another variable(sum) if the above condition is True.
Reply


Messages In This Thread
RE: I need help to solve this task using while statement - by Pranav - Mar-18-2020, 07:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Stuck with using lists to solve task gery576 9 1,026 Jan-16-2024, 06:29 PM
Last Post: DPaul
  How to solve this task? DERO 2 1,871 Dec-06-2021, 07:15 PM
Last Post: BashBedlam

Forum Jump:

User Panel Messages

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