An exercise

Back in the day I had to solve the following whiteboard exercise in Pascal.

Make a program that reads a character as input and outputs the uppercase of this character.

My solution was:

program project1;
Uses sysutils;
Var s:String;
begin
Read(s);
Writeln(UpperCase(s));
end.

Of course in Python 3 it would be:

print(input().upper())

and it would work with unicode characters also!

But what is the rationale behind this exercise? Is it to remember the upper method? Is it to remember the distance between lowercase and uppercase in the ASCII table?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s