Python: String Variables and Print Statements

Post Reply
User avatar
Jason
Site Admin
Posts: 749
Joined: Tue Jul 01, 2025 10:13 am

Code: Select all


person_name = "Homer Simpson"

person_career_name = "energy plant worker"

# String variables don't have to be declared, and they aren't in this example.

print(f"{person_name} has a career as a {person_career_name}.")

# The above statement prints out the sentence "Homer Simpson has a career as a energy plant worker." (no parenthesis)

 

POSTREACT(ions) SUMMARY

Post Reply