-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_types_and_variables.py
More file actions
269 lines (109 loc) · 2.28 KB
/
Copy pathdata_types_and_variables.py
File metadata and controls
269 lines (109 loc) · 2.28 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#!/usr/bin/env python
# coding: utf-8
# In[1]:
type(99.9)
# In[2]:
type('False')
# In[3]:
type(False)
# In[4]:
type('0')
# In[5]:
type(0)
# In[6]:
type(True)
# In[7]:
type('True')
# In[8]:
type([{}])
# In[9]:
type({'a': []})
# In[ ]:
#A term or phrase typed into a search box?: a string
#If a user is logged in?: a boolean
#A discount amount to apply to a user's shopping cart?: an integer
#Whether or not a coupon code is valid?: a boolean
#An email address typed into a registration form?: a string
#The price of a product?: a float
#A Matrix?: a list
#The email addresses collected from a registration form?: a string
#Information about applicants to Codeup's data science program?: a dictionary
# In[10]:
'1' + 2
# In[11]:
6 % 4
# In[12]:
type(6 % 4)
# In[13]:
type(type(6 % 4))
# In[15]:
'3 + 4 is ' + 3 + 4
# In[16]:
0 < 0
# In[17]:
'False' == False
# In[18]:
True == 'True'
# In[19]:
5 >= -5
# In[20]:
True or '42'
# In[21]:
6 % 5
# In[22]:
5 < 4 and 1 == 1
# In[23]:
'codeup' == 'codeup' and 'codeup' == 'Codeup'
# In[24]:
4 >= 0 and 1 != '1'
# In[25]:
6 % 3 == 0
# In[26]:
5 % 2 != 0
# In[27]:
[1] + 2
# In[28]:
[1] + [2]
# In[29]:
[1] * 2
# In[30]:
[1] * [2]
# In[32]:
[] + [] == []
# In[33]:
{} + {}
# In[ ]:
little_mermaid = 3
brother_bear = 5
hercules = 1
total_cost = (little_mermaid * 3) + (brother_bear * 3) + (hercules * 3)
print(total_cost)
# In[ ]:
google = 400
amazon = 380
facebook = 350
total_profit =(google * 6) + (amazon * 4) + (facebook * 10)
print(total_profit)
# In[34]:
class_is_full = True
schedule_is_full = False
can_enroll = schedule_is_full and not class_is_full
print(can_enroll)
# In[35]:
premium_member = True
discount_expired = False
num_items = 3
discount_applied = (premium_member or (num_items > 2)) and not discount_expired
print(discount_applied)
# In[53]:
username = 'codeup'
password = 'notastrongpassword'
username_white_space = (username[0] != ' ') and (username[-1] != ' ')
password_white_space = (password[0] != ' ') and (password[-1] != ' ')
password_len = 5 <= len(password) <= 20
not_same_as = username == password
print(password_len)
print(not_same_as)
print(username_white_space)
print(password_white_space)
# In[ ]: