Using a Variable Inside the String

sveemani at gmail.com sveemani at gmail.com
Mon May 6 14:44:59 EDT 2019


Hi all,

I am new learner of python programming and I am into my basics.
I got  struck with the code in   a sample  program and refer the same with IDE and  googling which did not help me for more than a day.

What is  wrong with  my last 2  lines?
what I am missing?

##################
my_name = 'Veera'
my_age = 40 #  Actually 42
my_height = 155 # Inches
my_weight = "80" # checking the double quotes
my_eyes = 'brown'
my_teeth = 'white'
my_hair =  'black'

print(f"Let's  talk  about  {my_name}.")
print(f"He's {my_height} inches  tall.")
print(f"He's {my_weight} weight heavy.")
print("Actually  thats  not too Heavy.")

print(f"He's  got {my_eyes} eyes and {my_hair}  hair.")
print(f"His  teeth are actually  {my_teeth} depending on the  coffee.")


### this  line are where I Struck #####
total =   my_age + my_height + my_weight
print(f"If I add {my_age}, {my_height}, and {my_weight} I get  {total} .")

##########################



More information about the Python-list mailing list