- Change the colour of the pen
- Draw a star with 12 points
- Draw a square using a for loop
- Draw a star using a for loop, fill in star in with colour
- Ask a user how big they want their square to be, then draw it
- Ask a user how big they want their star to be, then draw it - add this into program number 6
- Ask the user what shape they want, how big they want it to beand what colour they want it to be, then draw it
- Allow the user to define their own shapes
Showing posts with label programs to write. Show all posts
Showing posts with label programs to write. Show all posts
Thursday, 23 May 2013
Programs to build (Python Turtle)
Monday, 22 October 2012
Programs to build 3
Programs to build 3
Hangman
As much as hangman is quite a simple game, when you are learning to program it can be quite challenging to think about where you are going to start, and what you can realistically achieve.
You need to break the game down into sensible chunks, and building the program up bit by bit. You need to decide what programming syntax should be used in order to get the desired outcome.
Here is an example, thought up by year 9's as to the stages of hangman:
Stages of Hangman:
1. The computer thinks up a word
2. The computer tells the user how many letters are in the word
3. The user guesses a letter
4.a. If the letter is in the word, the computer outputs where abouts in the word it goes
4.b. If the letter is not in the word, the computer outputs the correct stage of the "hangman" cycle
5. Stages 4.a. and 4.b. repeat until the word is guessed or the user is "hung"
Stages of Programming a Simplified version of the Hangman game:
1.a. A simple guess the word game. As the programmer you define what the word is, the user gets one guess and are either right or wrong. The whole word is being guessed in one go.
1.b. The game continues until the user has guessed the word correctly.
2. A number of different words are stored in the program, and one is chosen by random. The user has to guess this word.
3. The word is broken down into letters (in the program) and the user has to guess each letter in the word.
Hangman
As much as hangman is quite a simple game, when you are learning to program it can be quite challenging to think about where you are going to start, and what you can realistically achieve.
You need to break the game down into sensible chunks, and building the program up bit by bit. You need to decide what programming syntax should be used in order to get the desired outcome.
Here is an example, thought up by year 9's as to the stages of hangman:
Stages of Hangman:
1. The computer thinks up a word
2. The computer tells the user how many letters are in the word
3. The user guesses a letter
4.a. If the letter is in the word, the computer outputs where abouts in the word it goes
4.b. If the letter is not in the word, the computer outputs the correct stage of the "hangman" cycle
5. Stages 4.a. and 4.b. repeat until the word is guessed or the user is "hung"
Stages of Programming a Simplified version of the Hangman game:
1.a. A simple guess the word game. As the programmer you define what the word is, the user gets one guess and are either right or wrong. The whole word is being guessed in one go.
1.b. The game continues until the user has guessed the word correctly.
2. A number of different words are stored in the program, and one is chosen by random. The user has to guess this word.
3. The word is broken down into letters (in the program) and the user has to guess each letter in the word.
Monday, 15 October 2012
Programs to build 2
Programs to build 2
Guess the Number
Write a simple guess the number game, where you decided what the number was, saved it in the program and then the user had to guess it (The original version of the game meant that the game terminated after one guess)
Extension: The game keeps going until the user has guessed the number correctly
Extension 2: The user only gets 5 guesses
You will need: if statement, print, input, int, variables
Interest Calculator
Write a program which works out how much interest you have earnt over a certain number of years.
You have £300, the interest rate is 5% and you are keeping it in the account for 5 years.
The program should tell you how much interest you earn each year, and a total.
Extension: The user can input their own amount, interest rate and number of years
You will need: for loop, print, variables (Extension: input, float)
Guess the Number (v2)
Amend your Guess the Number game so that it runs until the person has guessed the answer correctly. The number they are trying to guess should be chosen at random by the computer.
Extension: The user only gets 5 guesses
You will need: while, break, random
Logging in
Write a program which allows a user to "log on" to your system. Your program should ask the user for their user name and password, and check them against a username and password already stored in the program.
If they type both in correctly, they should get a message which says "Welcome", if they type either one in wrong they should get a message which tells them to try again. They should then be given the option of trying again.
You will need: if statement, boolean expression, variables, input, print
Guess the Number
Write a simple guess the number game, where you decided what the number was, saved it in the program and then the user had to guess it (The original version of the game meant that the game terminated after one guess)
Extension: The game keeps going until the user has guessed the number correctly
Extension 2: The user only gets 5 guesses
You will need: if statement, print, input, int, variables
Interest Calculator
Write a program which works out how much interest you have earnt over a certain number of years.
You have £300, the interest rate is 5% and you are keeping it in the account for 5 years.
The program should tell you how much interest you earn each year, and a total.
Extension: The user can input their own amount, interest rate and number of years
You will need: for loop, print, variables (Extension: input, float)
Guess the Number (v2)
Amend your Guess the Number game so that it runs until the person has guessed the answer correctly. The number they are trying to guess should be chosen at random by the computer.
Extension: The user only gets 5 guesses
You will need: while, break, random
Logging in
Write a program which allows a user to "log on" to your system. Your program should ask the user for their user name and password, and check them against a username and password already stored in the program.
If they type both in correctly, they should get a message which says "Welcome", if they type either one in wrong they should get a message which tells them to try again. They should then be given the option of trying again.
You will need: if statement, boolean expression, variables, input, print
Monday, 8 October 2012
Programs to build
Programs to build
Hello World
Write a program which outputs the words "hello world".
You will need: print
Hello name
Write a program which asks a user for their name, then outputs "Hello _____ " (With ____ being whatever they typed in.
Extension: Ask the user for their first name and surname separatley but print them out on the same line ("Hello _firstname_ _surname_")
You will need: print, input, variables
Mathematical operators
Write a program which asks a user to input their date of birth. The program then adds together what they input and outputs a number. The program should tell the user that this is their lucky number.
Extension: Adapt the program so that it is not obvious what maths has been done to calculate the lucky number (a bit like a secret code)
You will need: print, input, variables, mathematical operators
Writing lists
Write a program which stores 10 of your favourite things in a list. Using code delete out the 6th item in the list, add another favourite thing to the end of the list and print the list out 5 times. It is a good idea to check that your code is working properly - and we do this by printing out the list every time we change it.
You will need: list, print, delete, append
Using tuples
Write a program which stores a list of numbers in a turple, and a list of numbers in a list. The program should output the fourth number in the list, and the third number in the tuple.
Extension: Do some maths combining numbers from the list and tuple and output the answers.
You will need: list, turple, print
Hello World
Write a program which outputs the words "hello world".
You will need: print
Hello name
Write a program which asks a user for their name, then outputs "Hello _____ " (With ____ being whatever they typed in.
Extension: Ask the user for their first name and surname separatley but print them out on the same line ("Hello _firstname_ _surname_")
You will need: print, input, variables
Mathematical operators
Write a program which asks a user to input their date of birth. The program then adds together what they input and outputs a number. The program should tell the user that this is their lucky number.
Extension: Adapt the program so that it is not obvious what maths has been done to calculate the lucky number (a bit like a secret code)
You will need: print, input, variables, mathematical operators
Writing lists
Write a program which stores 10 of your favourite things in a list. Using code delete out the 6th item in the list, add another favourite thing to the end of the list and print the list out 5 times. It is a good idea to check that your code is working properly - and we do this by printing out the list every time we change it.
You will need: list, print, delete, append
Using tuples
Write a program which stores a list of numbers in a turple, and a list of numbers in a list. The program should output the fourth number in the list, and the third number in the tuple.
Extension: Do some maths combining numbers from the list and tuple and output the answers.
You will need: list, turple, print
Subscribe to:
Posts (Atom)