Python Forum
Constraints in for loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Constraints in for loop
#1
I am doing a challenge in hackerrank and was given this stub code:
for _ in range(int(input))
    name = input()
    score = float(input())
The constraints code to add is that make sure the loop goes at least two times and at most five times. That is, the first input from the range call should be 2<=N<=5.
I haven't come across anything like this in my life. Can someone help me out. I have Googled and checked stackoverflow but no ideas from those sources.
Thanks
Reply


Messages In This Thread
Constraints in for loop - by Emekadavid - Jun-13-2020, 06:23 AM
RE: Constraints in for loop - by buran - Jun-13-2020, 06:36 AM
RE: Constraints in for loop - by ndc85430 - Jun-13-2020, 06:36 AM

Forum Jump:

User Panel Messages

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