Study

Python print examples

  •   0%
  •  0     0     0

  • name = "Alice" print("Hello, " + name)
    "Hello Alice"
    Hello name
    Hello, Alice
    "Hello" + "Alice"
  • x = 5 y = 10 print(x + y)
    5
    10
    15
    2
  • print("5" + "5")
    55
    25
    "5+5"
    10
  • x = 3 print(x * x)
    6
    9
    3
    1
  • x = "123" y = 123 print(x == y)
    "123"
    TRUE
    "True"
    FALSE
  • a = 10 b = 20 a, b = b, a print(a, b)
    20 10
    10
    10 20
    30
  • x = 8 y = 3 print(x * y)
    5
    24
    11
    32
  • x = "5" y = int(x) print(y + 3)
    8
    2
    "53"
    53
  • x = "Hello" print(x * 3)
    3
    HelloHelloHello
    "Hello3"
    "3Hello"
  • a = "Python" b = "3.10" print(a + b)
    3.1
    "Python 3.10"
    "Python" + "3.10"
    Python3.10
  • num = input("Enter a number: ") print(num)
    It will print an error.
    It will not print anything.
    It will print the entered number as a string.
    It will print the entered number as an integer.
  • x = 10 y = 4 print(x / y)
    2
    14
    2.5
    4
  • x = 2.5 y = 4 print(x + y)
    6.5
    10
    2
    4.5
  • a = 7 b = 2 print(a - b)
    7
    5
    9
    2