-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathADAhomework-_-.py
239 lines (171 loc) · 6.19 KB
/
ADAhomework-_-.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
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
# # # # grades = ['34','43','9','67','100']
# # # # print(grades)
# # # # print(grades[2])
# # # # grades[2]=['78'] question 1
# # # # print(grades)
# # # # print(grades[2])
# # # # grades = ['34','43','9','67','100']
# # # # print(grades[0]+ ' ' +grades[4])
# # # # print(grades[-2])
# # # # fruits = ['apple','banana','orange','grape']
# # # # print(fruits[1])
# # # # print(type(fruits[0][2]))
# # # # string1 = 'Artemis'
# # # # print([0])
# # # # picture=[[1,2,3],
# # # # [4,5,6],
# # # # [7,8,9]]
# # # # print(picture)
# # # # print(picture[1][0])
# # # # (picture[0][0])=2
# # # # print(picture)
# # # numbers = []
# # # numbers.append(99)
# # # numbers.append(98)
# # # numbers.append(99)
# # # numbers.append(100)
# # # numbers.append(100)
# # # print (numbers)
# # # # Strings '123' "123" """123"""
# # # # Floating-point values (decimal values) <-- these are called either doubles or float
# # # # ints (integers) wholenumbers postivie or negative
# # # # chars 'a' '@' '1'
# # lists ['a', 'b']
# # # #
# # user_input = input('Input your first number(0 - 9): ')
# # # print(user_input)
# # a = 0
# # b = 1
# # c = 2
# # d = 3
# # e = 4
# # f = 5
# # g = 6
# # h = 7
# # i = 8
# # j = 9
# # if (user_input == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # else:
# # print('YOU ARE NOT FOLLOWING THE INSTRUCTIONS!')
# # user_input_2 = input('Input your second number(0 - 9): ')
# # print(user_input)
# # if (user_input_2 == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input_2 == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input_2 == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input_2 == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input_2 == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input_2 == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input_2 == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input_2 == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input_2 == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # if (user_input_2 == 'a','b','c','d','e','f','g','h','i','j'):
# # print('')
# # else:
# # print('YOU ARE NOT FOLLOWING THE INSTRUCTIONS!')
# # if (user_input + user_input_2 == 'a','b','c','d','e','f','g','h','i','j'):
# # print(user_input, '+' ,user_input_2)
# # first_number = input('Please input your first number: ')
# # print('Your number is' ,first_number )
# # second_number = input('Please input your second number: ')
# # print('Your number is' ,second_number )
# # sum = int(first_number) + int(second_number)
# # # sum2 = 4 + 9
# # # print('4 + 9 =', sum2)
# # print(first_number , '+' ,second_number, '=' ,sum )
# # first_number = input('Please input your first number: ')
# # print('Your number is' ,first_number )
# # second_number = input('Please input your second number: ')
# # print('Your number is' ,second_number )
# # try:
# # sum = int(first_number) + int(second_number)
# # print(first_number , '+' ,second_number, '=' ,sum )
# # except Exception as e:
# # print('YOU ARE NOT FOLLOWING THE INSTRUCTIONS! PLEASE RETRY WITH AN INTEGER!')
# # try:
# # first_number = input('Please input your first number: ')
# # second_number = input('Please input your second number: ')
# # sum = int(first_number) + int(second_number)
# # print('Your number is' ,first_number )
# # print('Your number is' ,second_number )
# # print(first_number , '+' ,second_number, '=' ,sum )
# # except:
# # print('YOU ARE NOT FOLLOWING THE INSTRUCTIONS! PLEASE RETRY WITH AN INTEGER!')
# # if (condition):
# # # code that executes iff condition is true
# # else:
# # # code that executes iff condition is false
# # and or not
# # operand1 or operand2
# user_input = int(input('Please enter a number: '))
# remainder = user_input % 2
# if(remainder == 0):
# print('Your number is even')
# if(remainder == 1):
# print('Your number is odd')
# # while
# # for
# # while (condition):
# # # code that executes WHILE the condition is true
# # number = 2
# # while (number >= 0):
# # print(number, end='')
# # number -= 1
# # user_input = int(input('Enter the number 7: '))
# # while (user_input != 7):
# # print('Bad Boy')
# # user_input = int(input('Your number was not 7, please enter the number 7: '))
# # for i in range(1,10):
# # print(i)
# string1 = 'hashim'
# for letter in string1:
# print(letter)
# myColor = input('Please input your color: ')
# if(myColor == 'Red' or myColor == 'RED' or myColor == 'red'):
# print('Your color is red!')
# if(myColor != 'Red' and myColor != 'RED' and myColor != 'red'):
# print('Your color is NOT red!')
# user_input = int(input('Please input your number: '))
# if (user_input >4 and user_input <10):
# print('Your number is between 5-10')
# if (user_input <4 or user_input >10): # really good check, althuogh if the user entered a letter(s), what's the problem?
# print('Your number is NOT between 5-10')
my_number = int(input('Please input your number: '))
remainder = my_number % 2
if (my_number > 0 and remainder == 0):
print('You have an even positive number')
if (my_number > 0 and remainder == 1):
print('You have an odd positive number')
if (my_number < 0 and remainder == 0):
print('You have an even negative number')
if (my_number < 0 and remainder == 1):
print('You have an odd negative number')
if (my_number == 0):
print('Your number is zero')