What does input() do?
is used to get data from the user
What does if do?
if is used to check a condition
What is a loop?
used to repeat code
What is a list?
used to stores multiple items
What will this display?
city="Bandung"
print("city")
city
Output of this program
x = 5
if x > 3:
print("Yes")
Yes
What is the output?
for i in range(3):
print(i)
0
1
2
What is the output?
fruits = ["apple", "banana"]
print(fruits[0])
apple
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)
Add else to this:
x = 2
if x > 5:
print("Big")
x = 2
if x > 5:
print("Big")
else:
print("Small")
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
What is the output:
fruits = ["apple"]
fruits.append("banana")
print(len(fruits))
2
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)
Write program:
num = int(input("Enter number: "))
if num > 10:
print("High")
elif num > 4:
print("Middle")
else:
print("Low")
Write a loop to countdown 10-1
x=10
for i in range (10):
print(x)
x=x-1
Write code to:
fruits = ["apple", "banana", "cherry"]
fruits[1] = "mango"
del fruits[2]