Input & Output
If/Elif/Else
Loops (For & While)
Lists
100

What does input() do?

is used to get data from the user

100

What does if do?

if is used to check a condition

100

What is a loop?

used to repeat code

100

What is a list?

used to stores multiple items

200

What will this display?

city="Bandung"

print("city")

city

200

Output of this program

x = 5

if x > 3:

    print("Yes")

Yes

200

What is the output?

for i in range(3):

    print(i)

 

0

1

2

200

What is the output? 

fruits = ["apple", "banana"]

print(fruits[0])

apple

300

Fix the error for mutiplication program:

a=input("Enter a number")

b=input("Enter a number")

r=a*b

print(r)

a=int(input("Enter a number")

b=int(input("Enter a number")

r=a*b

print(r)

300

Add else to this:

x = 2

if x > 5:

    print("Big")


x = 2

if x > 5:

    print("Big")

else:

    print("Small")

300

Fix the error to make program count 1 until 5:

i =1
while i < 6:  

   print(1)  

   i= i+0

i = 1
while i < 6:  

   print(i)  

   i= i+1

300

What is the output:

fruits = ["apple"]

fruits.append("banana")

print(len(fruits))

2

400

Create program to ask age of the user and diplay the age of the user with text combination "Your age is"

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

print("Your age is", age)

400

 Write program:

  • If number > 10 → print "High"
  • Else if number > 4  → print "Middle"
  • Else → print "Low"

num = int(input("Enter number: "))

if num > 10:

    print("High")

elif num > 4:

    print("Middle")

else:

    print("Low")

400

Write a loop to countdown 10-1

x=10

for i in range (10):

    print(x)

    x=x-1

400

Write code to: 

  • Change "banana" to "mango"
  • Delete "cherry"

fruits = ["apple", "banana", "cherry"]

fruits[1] = "mango"

del fruits[2]