Professional Documents
Culture Documents
What is Python?
Python is a very popular general-purpose interpreted, interactive, object-oriented, and high-level
programming language. It was created by Guido van Rossum during 1985- 1990. Like Perl, Python
source code is also available under the GNU General Public License (GPL).
print (counter)
print (miles)
print (name)
Algorithms:
Algorithm is a step-by-step procedure, which defines a set of instructions to be executed in a certain order
to get the desired output. Algorithms are generally created independent of underlying languages, i.e. an
algorithm can be implemented in more than one programming language.
How to Write an Algorithm?
There are no well-defined standards for writing algorithms. Rather, it is problem and resource
dependent. Algorithms are never written to support a particular programming code.
Example
Let's try to learn algorithm-writing by using an example.
• Problem − Design an algorithm to add two numbers and display the result.
step 1 − START
step 2 − declare three integers a, b & sum
step 3 − define values of a & b
step 4 − add values of a & b
step 5 − store output of step 4 to sum
step 6 − print sum
step 7 − STOP
Algorithms tell the programmers how to code the program. Alternatively, the algorithm can be
written as −
step 1 − START ADD
step 2 − get values of a & b
step 3 − sum ← a + b
step 4 − display sum
step 5 – STOP
Flowcharts
Flowcharts graphically represent the flow of a program. There are four basic shapes used in a flow
chart. Each shape has a specific use:
The program starts. Then the program prints out "Output!". Finally, the program ends.
# start
print("Output!")
# end
The program starts. Next, the program asks a user for a number. Two is added to the number.
Next, the resulting sum is printed. Finally, the program ends.
Programs:
sum_result=num1+num2
print(f"sum:{num1} + {num2} = {sum_result} ")
Q2: Write a Python program to calculate the area and perimeter of the square.
a=s*s
p=4*s
print("Area = ",a)
print("Perimeter = ",p)
Q4: Write a Python program to calculate the area and perimeter of the rectangle.
import turtle
t=turtle.Turtle()
turtle.bgcolor("red")
t.pensize(10)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
Q6: Write a Python turtle program to draw a circle and fill color.
import turtle
t=turtle.Turtle()
turtle.bgcolor("blue")
t.pencolor("purple")
t.fillcolor("orange")
t.pensize(10)
t.speed(4)
t.begin_fill()
t.circle(90)
t.end_fill()
import turtle
t=turtle.Turtle()
t.pensize(5)
t.pencolor("green")
t.forward(100)
t.left(120)
t.forward(100)
t.left(120)
t.forward(100)
import turtle
polygon = turtle.Turtle()
my_num_sides = 6
my_side_length = 70
for i in range(my_num_sides):
polygon.forward(my_side_length)
polygon.right(my_angle)
turtle.done()
import turtle
t=turtle.Turtle()
turtle.bgcolor("red")
t.pensize(10)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
Movie Making
Windows Movie Maker is divided into three main areas: the panes, the storyboard/timeline, and the preview
monitor. Windows Movie Maker provides several different panes that you can work in, depending on which
tasks you want to complete.
Characteristics of Window Movie Maker:
Windows Movie Maker allows you to quickly build a personalized movie that incorporates video, still
images, background music, and narration. This movie can be customized further by adding titles,
transitions, and video effects.
What are the groups in the Windows Movie Maker ribbon?
Movie Maker's interface consists of the "ribbon toolbar, preview window", and timeline. Ribbon Toolbar -
This comprises of main toolbars which are Home, Animations, Visual Effects, Project, and View.
Reference:
https://www.tutorialspoint.com/python/python_overview.htm
https://problemsolvingwithpython.com/08-If-Else-Try-Except/08.06-Flowcharts/