/+junk/Dataanalys

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/Dataanalys
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
#!/usr/bin/env python3.1
#-*- coding: utf-8 -*-

""" 
This file contains the cuestions that are to be awnserd.
the awnsers build up an sql query string that is then
commited to the sqlite database.

 """
#=========== start class ================

class awnserSheet:
	"""" This returns the sql string that is built up during the prosses """
	sqlString = str(" ") # the strin that is going to be commited.
	
	##This brings in the values and the sql string from sqlAwnsersStrat
	# and uses them as a string.
	f = open("./sqlAwnsersStart.sql")
	sqlStringStart = f.read()
	f.close()
	
	sqlStringEnd = ");"
	
	
	def qinput(): ## question input
		""" this function ruturns 1 or 0 or -1 when error """
		q = str(input("svara med 1 för sant och 0 för falskt:"))
		
		if(q != "0" and q != "1"):
			print("!!! the input is invalid !!! \n !!! Try again !!!")
			return("-1")
		else:
			return(q)
		
	## end question input
	## start addToSqlString
	def addToSqlString(q):
		""" This function just adds to the sqlstring the value of q """
		awnserSheet.sqlString = awnserSheet.sqlString + str(q) + str(", ")
	## end addToSqlString
	##start suestions section
	def question1():
		awnserSheet.sqlString = str(" ") # string cleanup!
		print("Fråga 1:")
		print("Tror du på en/flera personlig(a) gud/gudar?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question1()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question2():
		print("fråga 2:")
		print("tror du på spöken?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question2()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question3():
		print("Fråga 3:")
		print("Är du religiös?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question3()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question4():
		print("Fråga 4:")
		print("är du för ett sekulärt samhälle?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question4()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question5():
		print("Fråga 5:")
		print("Är du vegetarian/vegan?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question5()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question6():
		print("Fråga 6")
		print("Tycker du att mänskligheten skall besöka mars inom en snar framtid?")
		q = awnserSheet.qinput()
		if(q == "-1:"):
			awnserSheet.question6()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question7():
		print("Fråga 7:")
		print("Tror du att mänskligheten är orsaken till den observerade globalauppvärmingen?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question7()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question8():
		print("Fråga 8:")
		print("Tror du att vi varit på månen?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question8()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question9():
		print("Fråga 9:")
		print("Motionerar du regelbundet?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question9()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question10():
		print("Fråga 10:")
		print("Anser du att du har en sund livsstil?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question10()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question11():
		print("Fråga 11:")
		print("Blir du deprimerad/nedstämd på hösten/vintern?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question11()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question12():
		print("Fråga 12:")
		print("Gillar du snö?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question12()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question13():
		print("Fråga 13:")
		print("Är du för ett öppet samhälle?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question13()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question14():
		print("Fråga 14:")
		print("Är du för dödsstraff?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question14()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question15():
		print("Fråga 15:")
		print("Är du för kvinnors rättigheter?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question15()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question16():
		print("Fråga 16:")
		print("Är du för abort?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question16()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question17():
		print("Fråga 17:")
		print("Är du för kvinnors rätt att bestämma över sin egen kropp?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question17()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question18():
		print("Fråga 18:")
		print("Blir du deprimerad/nedstämd på våren?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question18()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question19():
		print("Fråga 19:")
		print("Tror du på den vetenskapliga metoden?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question18()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def question20():
		print("Fråga 20:")
		print("""Tror du att evolutionen som beskrivs i den mordärna
vetenskapen är ursprunget till de många arterna på denna planet?""")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.question18()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def questionI():
		print("Fråga I:")
		print("Är du gäststuderande här i Sverige?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.questionI()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def questionII():
		print("Fråga II")
		print("Är du född i Sverige?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.questionI()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def questionIII():
		print("Fråga III")
		print("Är en eller båda av dina föreldrar inte födda i Sverige?")
		q = awnserSheet.qinput()
		if(q == "-1"):
			awnserSheet.questionI()
		else:
			awnserSheet.addToSqlString(int(q))
		
	
	def questionCommentry():
		print("Komentarer:")
		print("Skriv en komentar på denna undörsökning:")
		q = str(input(">>>>>> "))
		awnserSheet.sqlString = awnserSheet.sqlString + " \" " + str(q) + "\" "
	#
###
###
	def questionAndReturn(self):
		awnserSheet.question1()
		awnserSheet.question2()
		awnserSheet.question3()
		awnserSheet.question4()
		awnserSheet.question5()
		awnserSheet.question6()
		awnserSheet.question7()
		awnserSheet.question8()
		awnserSheet.question9()
		awnserSheet.question10()
		awnserSheet.question11()
		awnserSheet.question12()
		awnserSheet.question13()
		awnserSheet.question14()
		awnserSheet.question15()
		awnserSheet.question16()
		awnserSheet.question17()
		awnserSheet.question18()
		awnserSheet.question19()
		awnserSheet.question20()
		awnserSheet.questionI()
		awnserSheet.questionII()
		awnserSheet.questionIII()
		awnserSheet.questionCommentry()
		
		print("\n\n======================== tack och adjöken ^_^ ===================\n\n")
	
		return( awnserSheet.sqlStringStart + awnserSheet.sqlString + awnserSheet.sqlStringEnd )