Jul 17, 2024
.py
extension (e.g., myname.py
)
.py
extension for Python files.x
, y
, z
).number = 4
(assigning value 4 to the variable number
).name = "Florence"
(assigning the string "Florence" to the variable name
).print()
function to display variable values.print(number)
and print(name)
.+
operator.print("Hello, my name is " + name + " and my age is " + str(number))
.input()
function to capture user input.name = input("What is your name?")
.age = int(input("How old are you?"))
.print("Hello, " + name + ". Nice to meet you!")
.str()
to convert integers to strings.print("I am " + str(diff) + " years older than you.")
.name = input("What is your name?")
age = int(input("How old are you?"))
program_age = 35
diff = program_age - age
print("I am " + str(diff) + " years older than you.")
print("")
.name = input("What is your name?")
age = int(input("How old are you?"))
diff = program_age - age
print("Hello, " + name + ". I am " + str(diff) + " years older than you.")
age = int(input("How old are you?"))
weight = int(input("How much do you weigh?"))
height = int(input("How tall are you?"))
print("Hello, " + name + ". I am " + str(diff) + " years younger than you.")