IGCSE Computer Science 2023-25 ​​- Topic 8: Programming (3) - Nested Statements

Опубликовано: 27 Октябрь 2024
на канале: Mr Bulmer's Learning Zone
7,883
109

This is the third video for Topic 8...Here you will be shown how to declare and use variables and constants in your code. Understand and use of the Basic Concepts including String Handling and Arithmetic, Logical and Boolean Operators.

IGCSE Computer Science 2023-25 ​​- Topic 8: Programming (3) - Nested Statements:    • IGCSE Computer Science 2023-25 ​​- To...  

#Computer Science #IGCSE #Exams #Cambridge #programming #coding

VIDEO to support Computer Science Syllabus
Cambridge IGCSE™ (9–1 0984) (A*-C 0478)
For exams in 2023, 2024 and 2025.

Cambridge IGCSE Computer Science helps learners develop an interest in computational thinking and an understanding of the principles of problem-solving using computers. They apply this understanding to create computer-based solutions to problems using algorithms and a high-level programming language. Learners also develop a range of technical skills, and the ability to effectively test and evaluate computing solutions.

Studying Cambridge IGCSE Computer Science helps learners appreciate current and emerging computing technologies, the benefits of their use and recognise their potential risks. It provides an ideal foundation for progression to Cambridge International AS & A Level and is valuable for other areas of study and everyday life.

THE CODE:
-------------------------------------------------------------------------------------------------------
'''
This code will draw a kaleidoscope pattern with 6 repetitions
and 6-sided shapes, using a range of colors. You can adjust
the size of the kaleidoscope and the number of sides and
repetitions to customize the pattern.
'''
import turtle
Set up the turtle
turtle.speed('fastest')
turtle.hideturtle()
turtle.colormode(255)

Set the size of the kaleidoscope
size = 200
Set the number of sides for the shapes in the kaleidoscope
sides = 6
Set the number of repetitions for the kaleidoscope pattern
reps = 6
Use nested for loops to draw the kaleidoscope pattern
for r in range(reps):
loop to create the number of repetitions of the pattern
for i in range(sides):
loop to create the number of sides in the pattern
turtle.color(i*(255//sides), 255-(i*(255//sides)), i*(255//sides))
set the color of the turtle using the current iteration and the total number of sides
turtle.begin_fill()
begin filling the shape
for j in range(sides):
loop to create the shape
turtle.forward(size)
turtle.right(360/sides)
turtle.end_fill()
turtle.right(360/sides)
turtle.right(360/reps)
rotate the entire pattern to create the kaleidoscope effect

Prevent the window from closing
turtle.exitonclick()