ΣνΜDr. Sharon's Math PlatformSyvara Learning
Question Bank › 📘 Undergraduate › Programming for Engineers › Q2

Q2 · Python has two common ways to insert variables into strings: the %-format style and…

Variables, Data Types, and Strings 🟢 Intro Coding
Question

Python has two common ways to insert variables into strings: the %-format style and f-strings.

(a) Using %-format, write code that prints: "Gonzaga is an awesome school in USA!"
(b) Rewrite using an f-string to produce the same output.
(c) What is the advantage of f-strings over %-formatting?

🔒

Log in to see the worked solution

Enter your email to get started. Your first free solutions in every course unlock as soon as you verify.

Log in or sign up with email
← Previous Next →
Working…