Exercises
  1. Write a code that shows in the Terminal: “Hello, my name is Ben”
    • Ben needs to be in a variable.
  2. Write a code that shows in the Terminal the type of these variables:
    • a=12
    • b=1.5
    • c=”Hello”
    • d=True
  3. Set a=”Ben” and try to print “Hi, my name is Ben” without using the “f” before the quotation marks.
  4. Set a=”Ben” and b=”10″, print(a+b), you might discover something new.

Solutions

1.

a="Ben"
print(f"Hello, my name is {a})

2.

a=12
b=1.5
c="Hello"
d=True
print(type(a))
print(type(b))
print(type(c))
print(type(d)) #We'll talk about this type of data next time :p

3.

a="Ben"
print("Hi, my name is", a)

4.

As you can see the “+” between two strings functions as a concatenation operator!

Posted in

Leave a comment