What is a variable in Python?
A container used to store data.
Which function is used to get user input?
input()
What does + do?
Addition
Which function displays output?
print()
Which is a correct variable name?
a) 2name
b) my_name
c) class
b) my_name
What does this do?
name = input("Enter your name: ")
Stores user input in variable name
What is the result?
5 * 2
10
What will this show?
print("Hello")
Hello
What will this store?
age = 13
The number 13
Why do we use int() with input?
To convert text into numbers
What is the result?
10+5/5
11
What is wrong?
print Assalamualaikum
Missing parentheses → print("Assalamualaikum")
Fix the error:
my age = 12
my_age = 12
Fix the code:
age = input("Enter age: ")
times=age*5
print(times)
age = int(input("Enter age: "))
times=age*5
print(times)
Fix the code so the x will be 3
x=10+5/5
x=(10+5)/5
What is the output?
x = "S"
y="2"
a=x+y
print(a)
S2
What is the output?
x = 5
y = x
x = 10
print(y)
5
What happens if we don’t convert input to int?
It stays as text (string)
create program to calculate area of square with side 3.
s=3
a=s*s
print(a)
Combine text and variable:
age=10
print (_______)
print("Age:", age)