-
Notifications
You must be signed in to change notification settings - Fork 0
/
program_variables.py
57 lines (40 loc) · 1.04 KB
/
program_variables.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# import date
from datetime import date
# program.py
sum = 1 + 2
print(sum)
# print hurry my first ever python program
print("Hurray! I wrote my first program in python")
product = sum * 2
print(product)
planets_in_solar_system = 8 # int, pluto used to be the 9th planet, but is too small
distance_to_alpha_centauri = 4.367 # float, lightyears
can_liftoff = True
shuttle_landed_on_the_moon = "Apollo 11" #string
# type of variable
print("planets_in_solar_syatem is a ",type(planets_in_solar_system))
# type of variable distance_to_alpha_centauri
print("distance_to_alpha_centauri is a ",type(distance_to_alpha_centauri))
# operators
x = 2
# print value of x = x
print("x=2")
print("value of x = ",x)
x += 2
print("x+=2")
print("value of x = ",x)
x -= 2
print("x-=2")
print("value of x = ",x)
x *= 2
print("x*=2")
print("value of x = ",x)
x /= 2
print("x/=2")
print("value of x = ",x)
x **= 3
print("x**=3")
print("value of x = ",x)
# print today's date with the prefix "Today is "
# use the date.today() function
print("Today is ",date.today())