Using (str)my_age in concatenation

#1

my_age = 20
half_my_age = my_age / 2
greeting = "Hello World! "
name = "My name is Seth and i am "
greeting_with_name = greeting + name + (str)my_age
print(greeting_with_name)

for some reason i get a syntax error when using (str)my_age in this code. any idea why?

2 Likes
#2

Try str(my_age) :wink:

1 Like
#3

ohhhhhhh, thank you! :smiley:

1 Like
#4

You’re welcome!
It’s always the little things…
Okay, not always, but frequently!
Happy Coding!