-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythonbasics.py
More file actions
117 lines (82 loc) · 2.39 KB
/
Copy pathpythonbasics.py
File metadata and controls
117 lines (82 loc) · 2.39 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#comments in Python are different from comments in other programming languages and it's pretty neat to learn it all
#self-explanatory
print("Hello world!");
#use of different quotes for strings
print("drewrolla");
print('drewrolla');
#learning variables
# We've defined the variable "meal" here to the name of the food we ate for breakfast!
meal = "An english muffin"
# Printing out breakfast
print("Breakfast:")
print(meal)
# Now update meal to be lunch!
meal = "Pizza sandwich"
# Printing out lunch
print("Lunch:")
print(meal)
# Now update "meal" to be dinner
meal = "Sushi and fries"
# Printing out dinner
print("Dinner:")
print(meal)
#fixing mismatched quotes
print('This message has mismatched quote marks!')
print("Abracadabra")
#numbers
# Define the release and runtime integer variables below:
release_year = 2012;
runtime = 120;
# Define the rating_out_of_10 float variable below:
rating_out_of_10 = 6.9;
#calculations
print(25 * 68 + 13 / 28);
#changing numbers
quilt_width = 8;
#original quilt_length = 12;
quilt_length = 8;
#original print(8 * 12);
print(8*8);
#exponents
# Calculation of squares for:
# 6x6 quilt
print(6 ** 2);
# 7x7 quilt
print(7 ** 2);
# 8x8 quilt
print(8 ** 2);
# How many squares for 6 people to have 6 quilts each that are 6x6?
print (6 ** 4);
#modulo
my_team = 27 % 4;
print(my_team);
#optional modulo
print(26%4);
print(28%4);
#concatenation
string1 = "The wind, "
string2 = "which had hitherto carried us along with amazing rapidity, "
string3 = "sank at sunset to a light breeze; "
string4 = "the soft air just ruffled the water and "
string5 = "caused a pleasant motion among the trees as we approached the shore, "
string6 = "from which it wafted the most delightful scent of flowers and hay."
# Define message below:
message = string1 + string2 + string3 + string4 + string5 + string6;
#print(message)
print(message);
#plus equals
total_price = 0
new_sneakers = 50.00
total_price += new_sneakers
nice_sweater = 39.00
fun_books = 20.00
# Update total_price here:
total_price += nice_sweater;
total_price += fun_books;
print("The total price is", total_price)
#multilines
# Assign the string here
to_you = """Stranger, if you passing meet me and desire to speak to me, why
should you not speak to me?
And why should I not speak to you? """
print(to_you)