Welcome to Coding Corner-this is a regular column about computing and coding in the classroom. Written by Dan Aldred (@Dan_Aldred) who is well worth a follow on Twitter. Dan’s article is about his students use of programming to write thank-you letters.

Christmas is a time that you may, if are lucky enough receive some gifts. Then comes that time when you should politely write and thank the givers of the gifts. How about if you could write a program to create these letters?

clip_image002

This will be the basis of my first lesson back with the students.

First I created some variables,

yn = this is your name

r = this is the person that you are writing to

p = this is the name of the person that gave you the present

t = [a random list of various nice comments for the recipient]

Next create the letter using the print function.

I have also used the new line feature \n to place the sentences on new lines.

Extensions activities would be for students to code the letter to print out or write to another file, maybe allow the user to create all the letters at once.

Example code

#Christmas thank you letters

import random

yn = raw_input("Please enter your name ")

r = raw_input("please enter the name of the person you are writing to " )

p = raw_input("please enter the present that you were given ")

t =[‘It really was a lovely present’,

‘I am so touched that you purchased the present’,

‘How very lucky I am I feel warm inside’,

‘It was such an amazing present’]

print ‘\nDear’, r

print ‘\nI am writing to say thank you for my Christmas present, I have always wanted a’, p

print "\nIt was very kind of you"

print(random.choice(t))

print "\nMany thanks again"

print "\nFrom", yn

 

Why not try some of this programming at home?

Dan’s new website has some brilliant ‘How to’ programming guides http://itecdigital.weebly.com/

clip_image004

Dan Aldred is a teacher of Computing and Head of IT. He is also a member of the school extended leadership team and teacher learning group.  He’s interested in how technology and software move learning forward.

Written by Julian S Wood - www.ideasfactory.me/about/"rel="author"
About me
UK Primary School Future Learning Technologist.I am into Experience and Fun Based Learning.I use web tools to stimulate writing. I've been Playing and Learning since 1970. Have some fabulous ideas now & again.. Check out my about.me profile!
Click Here to View All Nominated Educators
My LinkedIn Profile

To see my LinkedIn profile, click here:

Julian S Wood
edublogs-nominated-bestindivtweeter-150x150
Subscribe
Email subscription to blog
Map
Privacy Policy
Privacy Policy - www.ideasfactory.me

Privacy Policy for www.ideasfactory.me

If you require any more information or have any questions about our privacy policy, please feel free to contact us by email at skyblue_jules@talk21.com.

At www.ideasfactory.me, the privacy of our visitors is of extreme importance to us. This privacy policy document outlines the types of personal information is received and collected by www.ideasfactory.me and how it is used.

Log Files
Like many other Web sites, www.ideasfactory.me makes use of log files. The information inside the log files includes internet protocol ( IP ) addresses, type of browser, Internet Service Provider ( ISP ), date/time stamp, referring/exit pages, and number of clicks to analyze trends, administer the site, track users movement around the site, and gather demographic information. IP addresses, and other such information are not linked to any information that is personally identifiable.

Cookies and Web Beacons
www.ideasfactory.me does not use cookies.

DoubleClick DART Cookie

.:: Google, as a third party vendor, uses cookies to serve ads on www.ideasfactory.me.
.:: Google's use of the DART cookie enables it to serve ads to your users based on their visit to www.ideasfactory.me and other sites on the Internet.
.:: Users may opt out of the use of the DART cookie by visiting the Google ad and content network privacy policy at the following URL - http://www.google.com/privacy_ads.html

Some of our advertising partners may use cookies and web beacons on our site. Our advertising partners include
Google Adsense

These third-party ad servers or ad networks use technology to the advertisements and links that appear on www.ideasfactory.me send directly to your browsers. They automatically receive your IP address when this occurs. Other technologies ( such as cookies, JavaScript, or Web Beacons ) may also be used by the third-party ad networks to measure the effectiveness of their advertisements and / or to personalize the advertising content that you see.

www.ideasfactory.me has no access to or control over these cookies that are used by third-party advertisers.

You should consult the respective privacy policies of these third-party ad servers for more detailed information on their practices as well as for instructions about how to opt-out of certain practices. www.ideasfactory.me's privacy policy does not apply to, and we cannot control the activities of, such other advertisers or web sites.

If you wish to disable cookies, you may do so through your individual browser options. More detailed information about cookie management with specific web browsers can be found at the browsers' respective websites.