TeCoEd (Teaching Computing Education)
  • Home
    • Freelance
    • Book
    • Downloading
  • Python
    • Learn Python >
      • Python Modules
    • PyGame Zero
    • Python Programs >
      • Higher or Lower
      • Magic Calculator
      • Password Checker
      • Python Pit
    • What's News App
    • Pixels to Cells
    • Python Mosaics
    • Python OCR
    • L-1-AM
    • Web Scraping >
      • Scraping Trains
    • Weather App
    • Snakes and Windows
    • Python Web Server >
      • Flask
    • Python Picks
  • Ras Pi
    • All About the Pi
    • Getting Started
    • Remote Desktop and VNC
    • Static IP Address
    • Sonic Pi >
      • 3.14
    • Twitter Feed >
      • Tweepy
    • Android & Pi >
      • Advanced Apps
      • Odds
    • A.I on the the Pi
    • CRON
    • Pick Your Own
  • Pi Hardware
    • Pi HATS >
      • Sense Hat Hacks
      • AstroPi HAT
      • Unicorn-HAT >
        • Unicorn Alphabet Disco
        • Uni Codes / Programs
      • Skywriter
      • Piano HAT
    • STS Pi
    • Pi Camera >
      • Pi-Cam, Python & Email >
        • Time Lapse
      • Pi Noir
    • Pipsta >
      • Flask, Input & Printers
    • Raspberry Pi Power >
      • Energenie IR power
    • Pibrella
    • Distance Sensor
    • LCD Screen
    • Pi-Tooth
    • Robot Arm
    • PiGlow
    • PiFM
    • Accelerometer
    • PiFace >
      • Installing PiFace >
        • Python Commands
  • Pi-Hacks
    • Drone Hacks
    • Pi Glue Gun Hack
    • Blinkt!
    • Sonic Pixels
    • R2D2
    • Get to the chopper
    • Astro Bird
    • Twitter Translator
    • Hacking a Robot
    • Nature_Box >
      • Best Nature Photos
    • Wearable Tech >
      • Project New York
      • P.N.Y Part 2 Health
      • P.N.Y Part 3 Games
      • P.N.Y Part 4 Translation
    • Dino-Tweet
    • Other Links
  • Pi-Hacks 2
    • The Joker
    • Hologram Machine
    • Google Vision: Camera Tell
    • Yoda Tweets
    • Pi Phone
    • Darth Beats
    • Twitter Keyword Finder
    • Crimbo Lights Hack
    • Xmas Elf
    • Halloween 2016
    • Halloween Hack 2015
    • Socrative Zombie
    • Voice Translation
    • The Blue-Who Finder
    • GPIO, Twitter
    • Pi Chat Bot >
      • Dictionary Definitions
    • PiGlow & Email
    • Pibrella Alarm System
    • SMS with Python >
      • Spooking a Mobile
  • Pi-Hacks 3
    • LED Dance Suit
    • Ferminal
    • Crypto Tracker
    • David Bowie
    • Lamp Prank >
      • TEST
    • Yoda FM
    • Retro Player
    • LED Pixel Art
    • TARDIS
    • Battleships
    • LED Board
    • Night Vision
    • Enviro+ Weather
  • Minecraft
    • Minecraft API
    • Minecraft Sweeper
    • PiGlove: Minecraft Power Up
    • Minecraft Photo-booth
    • Rendering Pixels
    • Speed Cube
    • Lucky Dip
  • Computing
    • Why Computing?
    • Can You Compute
    • micro:bit
    • Coding Resources
    • Learn to Code >
      • Coding with iPads
      • Apps Creation Tools
      • sKratchInn
      • Sound Editing
    • Cheat Sheets
    • Theory
    • HOUR OF CODING
    • BEBRAS Computing Challange
    • Computer Facts
    • Free Software and Links
  • Contact Me
  • Random Hacks
    • Movile

What did you get for Christmas?

1/16/2013

0 Comments

 
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?

This was the basis of my first lesson back with the students.  First create 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








0 Comments



Leave a Reply.

    Author

    TeCoEd

    Archives

    August 2020
    July 2020
    October 2014
    April 2014
    February 2014
    January 2014
    November 2013
    September 2013
    August 2013
    July 2013
    June 2013
    March 2013
    January 2013

    Categories

    All
    Binary
    Computing
    Education
    Font
    New
    Nqt
    Pixels
    Primary
    Programming
    Teaching

    RSS Feed

Powered by Create your own unique website with customizable templates.