Python supports different type of variables such as whole numbers, floating point numbers and text. You do not need to specify the type of variable, you can simply assign any value to a variable. Type the program below and start it.
#!/usr/bin/python x = 3 # a whole number f = 3.1415926 # a floating point number name = "Python" # a string print(x) print(f) print(name) combination = name + " " + name print(combination) sum = f + f print(sum)
What you see on success
You should see several lines containing numbers and text:
Try the exercises below
1. Make a program that displays several numbers. 2. Make a program that solves and shows the summation of 64 + 32. 3. Do the same as in 2, but make it sum x + y.
After completing these continue with the next exercise.
1. Display several numbers
x = 5 y = 6 print(x) print(y) print(8)
2. shows the summation of 64 + 32.
x = 64 + 32 print(x)
3. create a program that sums x + y
x = 3 y = 4 z = x + y print(x)