Doubt - Range of values for Dates

42 views
Skip to first unread message

Shantanu

unread,
Oct 8, 2020, 3:53:35 AM10/8/20
to Discussion forum for Computational Thinking
The range of values for dates in the lecture is mentioned as 0,1,2...365

I understand that how it will be working when it starts from zero eg. print(31) will be 1st Feb.

But why is it starting from zero in the first place as the dates always start from 1, so shouldn't the range for dates be 1,2,3....365 ?

Aman Kumar

unread,
Oct 8, 2020, 4:27:57 AM10/8/20
to Discussion forum for Computational Thinking, s95.sh...@gmail.com
It's totally fine, I guess to start from 1 as well. There has been a general notation of initializing the value of a variable from 0, this might also be the case here. However one is free to use from 1 also, I guess.

Shantanu

unread,
Oct 8, 2020, 6:50:38 AM10/8/20
to Discussion forum for Computational Thinking, sci.am...@gmail.com, Shantanu
Thanks again Aman.

Computational Thinking Support 1

unread,
Oct 8, 2020, 1:15:33 PM10/8/20
to Shantanu, sci.am...@gmail.com, Discussion forum for Computational Thinking
In the real world, counting or sequencing always starts from 1.
But in computers, counting or sequencing starts from 0 because it is a binary number system.

Hence, we always start from 0 instead of 1.

--
You received this message because you are subscribed to the Google Groups "Discussion forum for Computational Thinking" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cs1001-discus...@nptel.iitm.ac.in.
To view this discussion on the web visit https://groups.google.com/a/nptel.iitm.ac.in/d/msgid/cs1001-discuss/faa5f20a-341c-49f0-9fb1-eaa4c29e4a35n%40nptel.iitm.ac.in.


--
Thanks & Regards,
Omkar Joshi
Course Instructor (Computational Thinking)
Online Degree Programme
IIT Madras
Reply all
Reply to author
Forward
0 new messages