bzr branch
http://gegoxaren.bato24.eu/bzr/%2Bjunk/Dataanalys
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
1 |
#!/usr/bin/env python3.1
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
2 |
#-*- coding: utf-8 -*-
|
3 |
||
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
4 |
"""
|
5 |
This file contains the cuestions that are to be awnserd.
|
|
6 |
the awnsers build up an sql query string that is then
|
|
7 |
commited to the sqlite database.
|
|
8 |
||
9 |
"""
|
|
10 |
#=========== start class ================
|
|
11 |
||
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
12 |
class awnserSheet: |
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
13 |
"""" This returns the sql string that is built up during the prosses """ |
14 |
sqlString = str(" ") # the strin that is going to be commited. |
|
15 |
sqlStringStart = """insert into awnsers( |
|
16 |
"gudar" ,
|
|
17 |
"spoken" ,
|
|
18 |
"sekulart" ,
|
|
19 |
"vegan" ,
|
|
20 |
"mars" ,
|
|
21 |
"globaluppvarmning" ,
|
|
22 |
"motion" ,
|
|
23 |
"sund" ,
|
|
24 |
"deprimerad_host" ,
|
|
25 |
"sno" ,
|
|
26 |
"oppet" ,
|
|
27 |
"dodsstraff" ,
|
|
28 |
"kvinnors_rattigheter" ,
|
|
29 |
"abort" ,
|
|
30 |
"kvinnors_kropp",
|
|
31 |
"deprimerad_var",
|
|
32 |
"gast_sverige",
|
|
33 |
"fodd_sverige",
|
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
34 |
"foraldrar_sverige",
|
35 |
"komentarer"
|
|
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
36 |
)
|
37 |
values("""
|
|
38 |
sqlStringEnd = ");" |
|
39 |
||
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
40 |
|
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
41 |
def qinput(): ## question input |
42 |
""" this function ruturns 1 or 0 or -1 when error """ |
|
43 |
q = str(input("svara med 1 för sant och 0 för falskt:")) |
|
44 |
||
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
45 |
if(q != "0" and q != "1"): |
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
46 |
print("!!! the input is invalid !!! \n !!! Try again !!!") |
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
47 |
return("-1") |
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
48 |
|
49 |
return(q) |
|
50 |
||
51 |
## end question input
|
|
52 |
## start addToSqlString
|
|
53 |
def addToSqlString(q): |
|
54 |
""" This function just adds to the sqlstring the value of q """ |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
55 |
awnserSheet.sqlString = awnserSheet.sqlString + " " + str(q) + ", " |
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
56 |
## end addToSqlString
|
57 |
##start suestions section
|
|
58 |
def question1(): |
|
59 |
print("Fråga 1:") |
|
60 |
print("Tror du på en/flera personlig(a) gud/gudar?") |
|
61 |
q = awnserSheet.qinput() |
|
62 |
if(q == "-1"): |
|
63 |
awnserSheet.question1() |
|
64 |
else: |
|
65 |
awnserSheet.addToSqlString(q) |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
66 |
|
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
67 |
|
68 |
def question2(): |
|
69 |
print("fråga 2:") |
|
70 |
print("tror du på spöken?") |
|
71 |
q = awnserSheet.qinput() |
|
72 |
if(q == "-1"): |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
73 |
awnserSheet.question2() |
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
74 |
else: |
75 |
awnserSheet.addToSqlString(q) |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
76 |
|
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
77 |
|
78 |
def question3(): |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
79 |
print("Fråga 3:") |
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
80 |
print("Är du religiös?") |
81 |
q = awnserSheet.qinput() |
|
82 |
if(q == "-1"): |
|
83 |
awnserSheet.question3() |
|
84 |
else: |
|
85 |
awnserSheet.addToSqlString(q) |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
86 |
|
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
87 |
|
88 |
def question4(): |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
89 |
print("Fråga 4:") |
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
90 |
print("är du för ett sekelärt samhälle?") |
91 |
q = awnserSheet.qinput() |
|
92 |
if(q == "-1"): |
|
93 |
awnserSheet.question4() |
|
94 |
else: |
|
95 |
awnserSheet.addToSqlString(q) |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
96 |
|
97 |
||
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
98 |
def question5(): |
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
99 |
print("Fråga 5:") |
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
100 |
print("Är du vegetarian/vegan?") |
101 |
q = awnserSheet.qinput() |
|
102 |
if(q == "-1"): |
|
103 |
awnserSheet.question5() |
|
104 |
else: |
|
105 |
awnserSheet.addToSqlString(q) |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
106 |
|
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
107 |
|
108 |
def question6(): |
|
109 |
print("Fråga 6") |
|
110 |
print("Tycker du att mänskligheten skall besöka mars inom en snar framtid?") |
|
111 |
q = awnserSheet.qinput() |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
112 |
if(q == "-1:"): |
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
113 |
awnserSheet.question6() |
114 |
else: |
|
115 |
awnserSheet.addToSqlString(q) |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
116 |
|
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
117 |
|
118 |
def question7(): |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
119 |
print("Fråga 7:") |
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
120 |
print(" Tror du att mänskligheten är orsaken till den observerade globalauppvärmingen?") |
121 |
q = awnserSheet.qinput() |
|
122 |
if(q == "-1"): |
|
123 |
awnserSheet.question7() |
|
124 |
else: |
|
125 |
awnserSheet.addToSqlString(q) |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
126 |
|
127 |
||
128 |
def question8(): |
|
129 |
print("Fråga 9:") |
|
130 |
print("tror du att vi varit på månen?") |
|
131 |
q = awnserSheet.qinput() |
|
132 |
if(q == "-1"): |
|
133 |
awnserSheet.question8() |
|
134 |
else: |
|
135 |
awnserSheet.addToSqlString(q) |
|
136 |
||
137 |
||
138 |
def question9(): |
|
139 |
print("Fråga 10:") |
|
140 |
print("Motionerar du regelbundet?") |
|
141 |
q = awnserSheet.qinput() |
|
142 |
if(q == " -1"): |
|
143 |
awnserSheet.question9() |
|
144 |
else: |
|
145 |
awnserSheet.addToSqlString(q) |
|
146 |
||
147 |
||
148 |
def question10(): |
|
149 |
print("Fråga 10:") |
|
150 |
print("Anser du att du har en sund livsstil?") |
|
151 |
q = awnserSheet.qinput() |
|
152 |
if(q == " -1"): |
|
153 |
awnserSheet.question10() |
|
154 |
else: |
|
155 |
awnserSheet.addToSqlString(q) |
|
156 |
||
157 |
||
158 |
def question11(): |
|
159 |
print("Fråga 11:") |
|
160 |
print("Blir du deprimerad/nedstämd på hösten/vintern?") |
|
161 |
q = awnserSheet.qinput() |
|
162 |
if(q == " -1"): |
|
163 |
awnserSheet.question11() |
|
164 |
else: |
|
165 |
awnserSheet.addToSqlString(q) |
|
166 |
||
167 |
||
168 |
def question12(): |
|
169 |
print("Fråga 12:") |
|
170 |
print("Gillar du snö?") |
|
171 |
q = awnserSheet.qinput() |
|
172 |
if(q == " -1"): |
|
173 |
awnserSheet.question12() |
|
174 |
else: |
|
175 |
awnserSheet.addToSqlString(q) |
|
176 |
||
177 |
||
178 |
def question13(): |
|
179 |
print("Fråga 13:") |
|
180 |
print("Är du för ett öppet samhälle?") |
|
181 |
q = awnserSheet.qinput() |
|
182 |
if(q == " -1"): |
|
183 |
awnserSheet.question13() |
|
184 |
else: |
|
185 |
awnserSheet.addToSqlString(q) |
|
186 |
||
187 |
||
188 |
def question14(): |
|
189 |
print("Fråga 14:") |
|
190 |
print("Är du för dödsstraff?") |
|
191 |
q = awnserSheet.qinput() |
|
192 |
if(q == " -1"): |
|
193 |
awnserSheet.question14() |
|
194 |
else: |
|
195 |
awnserSheet.addToSqlString(q) |
|
196 |
||
197 |
||
198 |
def question15(): |
|
199 |
print("Fråga 15:") |
|
200 |
print("Är du för kvinnors rättigheter?") |
|
201 |
q = awnserSheet.qinput() |
|
202 |
if(q == " -1"): |
|
203 |
awnserSheet.question15() |
|
204 |
else: |
|
205 |
awnserSheet.addToSqlString(q) |
|
206 |
||
207 |
||
208 |
def question16(): |
|
209 |
print("Fråga 16:") |
|
210 |
print("Är du för abort?") |
|
211 |
q = awnserSheet.qinput() |
|
212 |
if(q == " -1"): |
|
213 |
awnserSheet.question16() |
|
214 |
else: |
|
215 |
awnserSheet.addToSqlString(q) |
|
216 |
||
217 |
||
218 |
def question17(): |
|
219 |
print("Fråga 17:") |
|
220 |
print("Är du för kvinnors rätt att bestämma över sin egen kropp?") |
|
221 |
q = awnserSheet.qinput() |
|
222 |
if(q == " -1"): |
|
223 |
awnserSheet.question17() |
|
224 |
else: |
|
225 |
awnserSheet.addToSqlString(q) |
|
226 |
||
227 |
def question18(): |
|
228 |
print("Fråga 18:") |
|
229 |
print("Blir du deprimerad/nedstämd på våren?") |
|
230 |
q = awnserSheet.qinput() |
|
231 |
if(q == " -1"): |
|
232 |
awnserSheet.question18() |
|
233 |
else: |
|
234 |
awnserSheet.addToSqlString(q) |
|
235 |
||
236 |
||
|
7
by Gustav Hartvigsson
meh |
237 |
def questionI(): |
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
238 |
print("Fråga I:") |
239 |
print("Är du gäststuderande här i Sverige?") |
|
240 |
q = awnserSheet.qinput() |
|
241 |
if(q == " -1"): |
|
242 |
awnserSheet.questionI() |
|
243 |
else: |
|
244 |
awnserSheet.addToSqlString(q) |
|
245 |
||
246 |
def questionII(): |
|
247 |
print("Fråga II") |
|
248 |
print("Är du född i Sverige?") |
|
249 |
q = awnserSheet.qinput() |
|
250 |
if(q == " -1"): |
|
251 |
awnserSheet.questionI() |
|
252 |
else: |
|
253 |
awnserSheet.addToSqlString(q) |
|
254 |
||
255 |
def questionIII(): |
|
256 |
print("Fråga III") |
|
257 |
print("Är en eller båda av dina föreldrar inte födda i Sverige?") |
|
258 |
q = awnserSheet.qinput() |
|
259 |
if(q == " -1"): |
|
260 |
awnserSheet.questionI() |
|
261 |
else: |
|
262 |
awnserSheet.addToSqlString(q) |
|
263 |
||
264 |
def questionCommentry(): |
|
265 |
print("Komentarer:") |
|
266 |
print("Skriv en komentar på denna undörsökning:") |
|
267 |
q = str(input(">>>>>>")) |
|
268 |
wnserSheet.addToSqlString(q) |
|
269 |
#
|
|
270 |
###
|
|
271 |
###
|
|
272 |
def questionAndReturn(self): |
|
|
4
by Gustav Hartvigsson
fixed som shit and started the initial work on the awnser sheet... |
273 |
awnserSheet.question1() |
274 |
awnserSheet.question2() |
|
|
6
by Gustav Hartvigsson
Added a camand line interface, and finished up the awnser sheet thingy... |
275 |
awnserSheet.question3() |
276 |
awnserSheet.question4() |
|
277 |
awnserSheet.question5() |
|
278 |
awnserSheet.question6() |
|
279 |
awnserSheet.question7() |
|
280 |
awnserSheet.question8() |
|
281 |
awnserSheet.question9() |
|
282 |
awnserSheet.question10() |
|
283 |
awnserSheet.question11() |
|
284 |
awnserSheet.question12() |
|
285 |
awnserSheet.question13() |
|
286 |
awnserSheet.question14() |
|
287 |
awnserSheet.question15() |
|
288 |
awnserSheet.question16() |
|
289 |
awnserSheet.question18() |
|
290 |
awnserSheet.questionI() |
|
291 |
awnserSheet.questionII() |
|
292 |
awnserSheet.questionIII() |
|
293 |
awnserSheet.questionCommentry() |
|
294 |
||
295 |
||
296 |
print("\n\n======================== tack och adjöken ^_^ ===================\n\n") |
|
297 |
||
298 |
return( awnserSheet.sqlStringStart + awnserSheet.sqlString + awnserSheet.sqlStringEnd ) |
|
299 |
||
300 |