# Gets the user's name and greets them my_name = "Jason" user_name = input("Enter your name: ") print(f"Hello {user_name}, nice to meet you. I am {my_name}.\n") # Gets the user's age and compares my_age = 31 user_age = input("Enter your age: ") difference = my_age - int(user_age) print(f"I am {difference} years older than you.")
"hello"
1
or
-76
1.5
or
0.006
=
operator. Variable names can contain only letters,
numbers, and the underscore symbol, and the first character cannot be a
number. So variable223
and new_value1
are
valid variable names, but 1num
and v@r
are
not. Variables should be all lowercase, and words should be separated
by underscores. This is called snake case.
print(f"Hello {user_name}, nice to meet you. I am {my_name}.\n")
in the code is an example of an f-string. Put the letter f
in front of the quotes, and wrap variables in curly brackets.
x = "hello"
y = -4.6
z = 187
my var = 12
Your code
name = "Jessica"
Your code
age = 12
Your code