Data type question

150 views
Skip to first unread message

Ravindra Singh

unread,
Oct 9, 2020, 5:44:00 AM10/9/20
to Discussion forum for Computational Thinking
I couldn't understand the character data type and it's subtype mainly string and transformation of subtype. Can you explain with examples 

Zeaan Pithawala

unread,
Oct 9, 2020, 6:03:26 AM10/9/20
to Discussion forum for Computational Thinking
String and Character data types are two different data types. Can you please tell specifically what you didn't understand? So it will be better for me to explain it to you in detail. Just specify the topic or specify what you didn't understand from the PowerPoint slides.

Ravindra Singh

unread,
Oct 9, 2020, 6:51:00 AM10/9/20
to Discussion forum for Computational Thinking, zeaanpit...@gmail.com
Actually,  I didn't understand character data type and also complex datatype. 

Ravindra Singh

unread,
Oct 9, 2020, 6:52:38 AM10/9/20
to Discussion forum for Computational Thinking, zeaanpit...@gmail.com
And also string data type.  

On Friday, October 9, 2020 at 3:33:26 PM UTC+5:30 zeaanpit...@gmail.com wrote:

Computational Thinking Support 2

unread,
Oct 9, 2020, 12:45:45 PM10/9/20
to Discussion forum for Computational Thinking, ravindrasi...@gmail.com, zeaanpit...@gmail.com
Hi,

Character

For an example that we frequently see around us, consider letter grades such as A, B, C and D that are given by some colleges. Here, we could treat grade as a variable of the character datatype. 

Variable: Grade
Datatype: Character
Values: A, B, C, D

Another example is this: consider the outcome of a cricket match; it could be one of the three things: win, loss, tie. Let us assume that we are looking at only those matches which were completed successfully without being washed out. We could now define a variable called outcome.

Variable: Outcome
Datatype: Character
Values: W, L, T

We could have also used three strings: "win", "loss" and "tie". But we are making it unnecessarily long when we can do the job with just the characters 'W', 'L' and 'T'. I hope this gives you some more insight into the difference between characters and strings.

String

A string is a sequence of characters. Names of people, cities, addresses can all be treated as strings. You cannot express a name using a single character. At least I don't know of anyone who has a single character for their name!

Regards,
Karthik
Instructor, Computational Thinking

Mahendrasinh Parmar

unread,
Oct 11, 2020, 3:34:40 AM10/11/20
to Discussion forum for Computational Thinking, ct-su...@onlinedegree.iitm.ac.in, ravindrasi...@gmail.com, zeaanpit...@gmail.com
Please answer which data types are this

  1. A2
  2. A2@
Reply all
Reply to author
Forward
0 new messages