You are on page 1of 4

Programming Input Activity

In the Python editor, type in the small program (or copy and paste it) in the first column of the
table. When typing these programs, be very careful to type exactly what is shown.

Run the program.

Copy and paste what the program displays - the output of the program - into the second column
of the table. Enter any notes you want to add as well. Be sure to note the 3 RUNTIME ERRORS
and 2 LOGICAL ERRORS.

There is no need to save these programs but save the document with the output and your
notes, and submit to the Hand In folder.

Program Code Output and Notes

name=input("Enter your name: ");


print(name, "is awesome!");
I entered my name and the output said I
wasawsome :D

age=int(input("Enter your age: "));


print(age);

It asked for my age and printed my age

mark = input("Enter your mark out of 10: ");


percent = mark*10;
print(percent, "%");
“Logical Error” I inputted the mark out of
10 and it gave me a percentage from
multiplying. You forgot the Int.

mark = int(input("Enter your mark out of 10: "));


percent = mark*10;
print(percent, "%");

I inputted the mark out of 10 and it


outputted the correct percentage

run the program above, again, but input your name


instead

“Runtime Error” It gave me an error


because there was no errors in the code
but in the execution, I put a word instead
of an integer.

run the program above, again, but input the


number 7.5
“Runtime Error” I received an error due
to having wrong execution. I can only
put a integer(full numbers) but I put a
decimal which caused the error.

from graphics import *


win=GraphWin("My Graphics",400,400);

#create circle at (200,200) with specified radius


radius=int(input("Enter the radius of the circle: "));
myCircle=Circle(Point(200,200),radius);
myCircle.draw(win);

I entered the code and I was asked to


put in a radius and then it made a circle.

from graphics import *


win=GraphWin("My Graphics",400,400);

#create circle with specified values


radius=int(input("Enter the radius of the circle: "));
centreX=int(input("Enter the x location: "));
centreY=int(input("Enter the y location: "));
myCircle=Circle(Point(centreX,centreY),radius);
myCircle.draw(win);
I entered the code and received a
question about how big the radius
should be and where should the x and y
meet.

number1=float(input("Input a number: "));


number2=float(input("Input a second number: "));
print("The first number is",number1);
print("The second number is",number2);
I firstly ran the code and it gave me the
option to pick a number and another
number. Then it turned those numbers
in to decimals.

number1=float(input("Input a number: "));


number2=float(input("Input a second number: "));
result=number1/number2;
Firstly after running the code, I received
print(number1,"/",number2,"=",result);
the option to pick any number I wanted,
than it asked for another number and
then divided both of them numbers I
inputted.

run the program above, again, but input the


number 0 for the second number asked for
“Runtime error” I received an error after
writing the second number as 0.

number1=float(input("Input a number: "));


number2=float(input("Input a second number: "));
average=(number1+number2)/2;
When I entered my code, I received the
print("The average is",average);
option to pick 2 numbers and then they
averaged it out my numbers.

number1=float(input("Input a number: "));


number2=float(input("Input a second number: "));
average=number1+number2/2;
print("The \"average\" is",average); “Logical Error” When I entered my code,
I received the option to pick 2 numbers
again but when it averaged it out, I
received 9000.00 rather than 5550.00.
For the last two programs above complete an IPO table, similar to the one below. List what the
program asked for input, what processing or calculations the program did and what the program
output, as is done with the example for the third last program.

Input Processing Output


number1, result = number1 / number2 result
number2

Input Processing Output


Problem 1: Problem 1: The program took 2 of the numbers you Problem 1: 5550.0
number1=float(input("Input a inputted in the shell and added them together and Problem 2: 9000.0
number: ")); divided them by 2, to get the average of the 2 numbers
number2=float(input("Input a you inputted.
second number: "));
average=(number1+number2)/2; Problem 2: The program takes two of the numbers
print("The average you inputted and then adds them together and then
is",average); divides them, but then takes the answer and adds
11,100.00 to it and divides it again which gives the
Problem 2 : answer 9000.00.
number1=float(input("Input a
number: "));
number2=float(input("Input a
second number: "));
average=number1+number2/2;
print("The \"average\"
is",average);

You might also like