Font size
WorksheetsQuiz 1
Total questions: 21
Worksheet time: 15mins
what is IPO?
computer work
{ Input, Proses, Output }
a process of coding that produces something
quickly found applications outside of computer
programming as a practical methodology in general systems
what is variable?
commands
is a type data
data storage
string and integer
How do you declare a variable based on user input?
my_data = "allinpython"
age = input{" How old are you ? "}
input = food("what is your favorite food ? ")
animals = input("what is your favorite animal ? ")
which is an example of using strings
Y = 1
print(Y)
a = "Hello"
print(a)
a = "red"
print( "my favorite color is " ,a)
x = range(6)
print(x)
which is an example of using float
a = "Hello, World!"
print(len(a))
x = 3+5j
y = 5j
z = -5j
x = 35e3
y = 12E4
z = -87.7e100
x = 1
y = 35656222554887711
z = -3255522
which is an example of using integer
x = 1
y = 35656222554887711
z = -3255522
thislist = ["apple", "banana", "cherry"]
x = 1.10
y = 1.0
z = -35.59
x = 3+5j
y = 5j
z = -5j
which is an example of a wrong variable name?
MY_NAME = "variable"
myname1 = "variable"
my name = "variable"
my_name = "variable"
how to create output in python?
x = "Sally"
print(x)
a = 33
b = 200
if b > a:
cars = ["Ford", "Volvo", "BMW"]
x = cars[0]
which one an example of an incorrect data type?
string
integer
boolean
math
what is coding?
code to command and create amazing things with technology
a collection of strange characters put together and colorful
something amazing at computer
something that make us confuse
what is looping?
plan to solve a problem at coding
choose conditional that true, if we have false it will repeat until true
repeating a set of instructions multiple times
Used for iterating as long as a certain condition is true.
What is the use of the 'print' function in Python?
print("Hello, World!")
print(5 + 3)
print("Python is fun!")
print("I love coding")
Explain the concept of 'if' statement in Python.
if x > y:
print("x is greater than y")
if x < y:
print("x is less than y")
if x == y:
print("x is equal to y")
if x != y:
print("x is not equal to y")
What is the purpose of using 'len' function in Python?
len("Hello, World!")
len([1, 2, 3, 4, 5])
len("Python")
len((1, 2, 3))
what is function at python?
Functions help break down code into smaller, easier to understand parts
Functions can be reused across programs, saving time and effort in writing code.
Functions can be grouped based on their functionality, making it easier to test and debug code.
A function is a program that cannot be repeated
how to create a function?
just need to call using the 'print()' syntax
we need a declaration first using the 'def' syntax
using syntax while true do:
we need to create input first before we call the name of the function
what is conditional statement?
used to access the operating system, such as reading input from the keyboard
execute different code blocks based on whether a certain condition is true or false
conditional statement is a programming construct that allows you to make decisions
helps break down code into smaller, easier to understand parts
which one example of conditional statement in python?
if age >= 18: print("You are eligible to vote.") else: print("You are not eligible to vote.")
def add_numbers(a, b): return a + b print(add_numbers(10, 20))
let number = 1; while (number <= 20) { if (number % 2 === 0) { console.log(number + " is even."); } number++; }
fruits = ["apple", "banana", "orange"] for fruit in fruits: print(fruit.upper())
What is the purpose of using 'for' loop in Python?
Iterating over a sequence of elements
Executing a block of code repeatedly
Performing a specific action based on a condition
Defining a function to be called later
Explain the concept of 'elif' statement in Python.
It is used to check for multiple conditions
It is used to define a new function
It is used to iterate over a sequence
It is used to execute a block of code repeatedly
What is the use of the 'input' function in Python?
It is used to print output to the console
It is used to take user input from the console
It is used to define a new function
It is used to iterate over a sequence
