Python Forum
This is weird!!! It should work but I get an but I get a "ValueError: I/O operation"
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
This is weird!!! It should work but I get an but I get a "ValueError: I/O operation"
#2
I don't see why you would want to quit () after printing True or False only once. Try it like this as see if it does what you're expecting.

def has_33(nums):
	length = len (nums) - 1
	for i in range (length):
		if nums [i] == 3 and nums [i+1] == 3:
			return True
	return False

print (has_33([1, 3, 1, 3]))
print (has_33([3, 1, 3]))
print (has_33([1, 3, 3]))
Reply


Messages In This Thread
RE: This is weird!!! It should work but I get an but I get a "ValueError: I/O operation" - by BashBedlam - Mar-24-2021, 02:25 AM

Forum Jump:

User Panel Messages

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