Creating a variable produces no visible output. To see a value, print it.
city = "Brisbane"
print(city)
Output:
Brisbane
print shows the value of whatever is between the parentheses. Each print produces one line:
print("first")
print("second")
Output:
first
second
print accepts several values separated by commas and shows them on one line with spaces between them:
name = "Parsnip"
age = 36
print(name, age)
Output:
Parsnip 36
name holding the string "Parsnip".year holding the number 2026.name, then print year on the next line.Run your code to see the output, then press Submit.
import unittest
class TestPrint(unittest.TestCase):
def test_name(self):
self.assertEqual(name, "Parsnip")
def test_year(self):
self.assertEqual(year, 2026)
name = "Parsnip" year = 2026 print(name) print(year)
Sign in to join the discussion.
No comments yet. Be the first to ask a question.
Press Run to execute your code, or Submit to test and complete this problem.