Python Forum
Two loops behaving differently
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Two loops behaving differently
#1
One of the options below prints "a = 1" as the first term and the other doesn't. WHY ?

for a in range(1, 4, 1): # This option prints a = 1 as first term in results
#for a in range(1, 50, 10): # This option does not print a = 1
print(a = ", a)
b = 0
while b < 5:
z = b*4
z += 1
print(" b = ",b)
Reply


Messages In This Thread
Two loops behaving differently - by DavidTheGrockle - Dec-26-2020, 03:24 PM
RE: Two loops behaving differently - by deanhystad - Dec-26-2020, 08:05 PM
RE: Two loops behaving differently - by deanhystad - Dec-27-2020, 03:56 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  ConfigParser(dict_type=) not behaving as expected malonn 5 3,328 Sep-08-2022, 08:42 AM
Last Post: malonn
  List comprehension used differently coder_sw99 3 1,748 Oct-03-2021, 04:12 PM
Last Post: coder_sw99
  if condition not behaving as expected EricBHK 10 3,840 May-16-2020, 03:41 PM
Last Post: EricBHK
  Hash command works differently for me in CMD and Spyder ZweiDCG 3 2,371 Sep-10-2019, 01:10 PM
Last Post: DeaD_EyE
  Requests not behaving... PythonLamer 1 4,824 Dec-01-2017, 06:45 PM
Last Post: nilamo
  Why does Function behave differently in a class vs. outside a class? Leaf 4 3,706 Nov-30-2017, 11:13 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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