0% found this document useful (0 votes)
2 views

What is a Computer Program

A computer program is a set of instructions written in a programming language that tells a computer what to do, while algorithms provide step-by-step instructions to solve problems. Python is a high-level programming language that uses variables, lists, and functions to create programs, and includes tools like IDLE for writing code. Key programming concepts include conditions for decision-making, loops for repeating code, and handling errors such as syntax and logical errors.

Uploaded by

imran.zafar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

What is a Computer Program

A computer program is a set of instructions written in a programming language that tells a computer what to do, while algorithms provide step-by-step instructions to solve problems. Python is a high-level programming language that uses variables, lists, and functions to create programs, and includes tools like IDLE for writing code. Key programming concepts include conditions for decision-making, loops for repeating code, and handling errors such as syntax and logical errors.

Uploaded by

imran.zafar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

What is a computer program?

A computer program is a set of instructions, written in a programming language that tells a


computer what to do.
How computers work?
A program is written by a programmer. Computers understand instructions in 1s and 0s,
called machine code. This code is the simplest form of software that the computer’s
processor can run. Programming languages use English words, grammar, and special rules
(syntax) to create instructions that a computer can follow.
What is an algorithm?
An algorithm is a step-by-step list of instructions that need to be followed in order to solve a
problem. These instructions must be clear and simple to understand.
What is a flowchart?
A flowchart is a diagram that shows an algorithm. It displays the steps and their correct
order, breaking the solution into smaller tasks or specific instructions.
How can we define a problem?
Before designing a program, you need to clearly define and understand the problem and
know what steps are needed to achieve your goal.
What is Python Programming?
Python is a text-based, high-level programming language that is easy to understand and
read. It is used to create computer programs.
What is Python IDLE?
Python IDLE is a text editor for Python. Its full form is Integrated Development and Learning
Environment. It provides a virtual space to write, create, and test Python programs by
running the code.
What are variables in python?
To make calculations and show results, you use variables. A variable is like a nickname for
something the computer needs to remember. It is a data container that holds a value.
What are Lists in programming languages?
In Python, you can store data in variables, but also in lists. A list is an ordered collection of
items, which can be of any data type. It keeps the items in a specific order.
Which commands are used to delete and add elements from the list?
To remove an element from a list, you can use the del command if you know the exact
element. To add an element to a list, you can use the append command followed by the list’s
name and the element you want to add.
What is the use of equal sign (=) in python programming language?
In Python, the equal sign is used to assign a value to a variable, not like in math. The variable
goes on the left side, and the value goes on the right side of the equals sign. The value on
the right is called the result value.
What is the function of print command in python programming?
The simplest command in Python is to display data on the screen. The print command is
used to show text on the screen. Any text written inside inverted commas (quotes) will be
displayed as output.
What is known as input command in python?
The input() function in Python is used to read a line of text from the user. When the input()
function is called, it displays a prompt (if provided) and waits for the user to enter some
input. Once the user presses Enter, the function returns the input and provides the output.
What is the use of comments in python programming?
We use comments to explain what our code does. This helps when making changes later. To
add a comment, put a hash (#) before the text. The computer ignores everything after the
hash.
How can we perform calculations on python?
You can use Python for any kind of calculation, like addition, subtraction, multiplication, and
division. The rules for using parentheses in Excel also apply here in Python.
What are strings in python programming?
You can join two or more strings and create a larger one by using the plus sign (+). You can
use string variables or direct text, for example:
Sport="SprintRace"
FullEvent="100metres"+Sport
If you had:
Distance="100metres"
Sport="SprintRace"
and you type the following:
FullEvent=Distance+sport
print(FullEvent)
it will be displayed:
100metresSprintRace
What are known as conditions in computer programs?
Conditions are also called decision making is an important and powerful tool of every
programmer developing an application such as a video game. You can write a program that
will be able to respond to user input during its execution and give different results for
different inputs. This process is possible with the use of conditions.
Example:
if Triathlon points < 100:
print(“Please Try Again”)
else:
print(“Well done get ready for the next event”)
What are multiple conditions in computer programs?
Sometimes you have to make a selection between more than two possible cases. In Python you can
use elif. In this way, a command is executed as soon as one of the conditions is true.

Look at this program:


#Medal awards
if Triathlon Points>=120:
MedalName="Gold"
elif TriathlonPoints>=115:
MedalName="Silver"
elif TriathlonPoints>=110:
MedalName="Bronze"
Else:
print("You have to try harder!")
What are conditional and logical operators in python?

Conditional Operators and their meanings

== Equal to

> More than

< Less than

>= More than or equal to

<= Less than or equal to

!= Not Equal to

Logical operators and their meanings

and Both sides must be true

or One side or another must be true

not Negates truth


What is known as a loop in a computer program?
A loop in programming repeats a block of code multiple times based on a condition, saving
you from writing the code repeatedly. It’s a key control structure in programs.
What is known as a function in a computer program?
Often, you may need to repeat the same instructions in a program. Instead of copying the
code multiple times, you can create functions. A function is a block of code defined in your
program that can be "called" whenever needed to perform a specific task.
What is known as Tkinter in python?
Tkinter is a library in python programming which is used to create a new basic window on
your screen where you will display graphics and drawing canvas.
What are bugs in a computer program?
A computer bug is a problem in a program, an error that has to be fixed.
How many types of problems and errors in programming code?
Syntax error: Errors in typing the commands which are usually easy to find.
Logical error: It is a mistake which you may have made in the design of the program, a
wrong sequence of commands or the use of wrong variables, over here everything is fine
but the results are not what you expected. That is why developers have to be extra careful
when they create a program.
What are events in a computer program?
Events are like signals that are raised, in response to user actions like typing with a keyboard
or moving the mouse or clicking it.

You might also like