Python Forum

Full Version: Wrong output in Visual Studio Code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Python experts,

I have started using "Visual Studio Code" and its giving little weird results.

daysInWeek={"Mon","Tues","Wed","Thur","Fri","Sat","Sun"}
for i,d in enumerate(daysInWeek):
  print(i, d)
this code is show the following results:
Output:
0 Fri 1 Wed 2 Tues 3 Thur 4 Sat 5 Sun 6 Mon
but it should be in sequence ( such as 0 Mon, 1 Tues...so on)

Any suggestions ? what could be wrong here..
The result is nothing to do with visual studio code.

daysInWeek={"Mon","Tues","Wed","Thur","Fri","Sat","Sun"} is a set which is unordered.

change the {} to a tuple () or a list [] and the results will be as expected.