/+junk/Dataanalys

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/%2Bjunk/Dataanalys

« back to all changes in this revision

Viewing changes to awnser_sheet.py

  • Committer: Gusatv Hartvigsson
  • Date: 2011-02-13 13:50:51 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20110213135051-y7y27gw00qebgt80
added the finnished report

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
        
16
16
        ##This brings in the values and the sql string from sqlAwnsersStrat
17
17
        # and uses them as a string.
18
 
        f = open("./sqlAwnsersStrat.sql")
 
18
        f = open("./sqlAwnsersStart.sql")
19
19
        sqlStringStart = f.read()
20
20
        f.close()
21
21
        
29
29
                if(q != "0" and q != "1"):
30
30
                        print("!!! the input is invalid !!! \n !!! Try again !!!")
31
31
                        return("-1")
32
 
                
33
 
                return(q)
 
32
                else:
 
33
                        return(q)
34
34
                
35
35
        ## end question input
36
36
        ## start addToSqlString
37
37
        def addToSqlString(q):
38
38
                """ This function just adds to the sqlstring the value of q """
39
 
                awnserSheet.sqlString = awnserSheet.sqlString + " " + str(q) + ", "
 
39
                awnserSheet.sqlString = awnserSheet.sqlString + str(q) + str(", ")
40
40
        ## end addToSqlString
41
41
        ##start suestions section
42
42
        def question1():
 
43
                awnserSheet.sqlString = str(" ") # string cleanup!
43
44
                print("Fråga 1:")
44
45
                print("Tror du på en/flera personlig(a) gud/gudar?")
45
46
                q = awnserSheet.qinput()
46
47
                if(q == "-1"):
47
48
                        awnserSheet.question1()
48
49
                else:
49
 
                        awnserSheet.addToSqlString(q)
 
50
                        awnserSheet.addToSqlString(int(q))
50
51
                
51
52
        
52
53
        def question2():
56
57
                if(q == "-1"):
57
58
                        awnserSheet.question2()
58
59
                else:
59
 
                        awnserSheet.addToSqlString(q)
 
60
                        awnserSheet.addToSqlString(int(q))
60
61
                
61
62
        
62
63
        def question3():
66
67
                if(q == "-1"):
67
68
                        awnserSheet.question3()
68
69
                else:
69
 
                        awnserSheet.addToSqlString(q)
 
70
                        awnserSheet.addToSqlString(int(q))
70
71
                
71
72
        
72
73
        def question4():
73
74
                print("Fråga 4:")
74
 
                print("är du för ett sekelärt samhälle?")
 
75
                print("är du för ett sekulärt samhälle?")
75
76
                q = awnserSheet.qinput()
76
77
                if(q == "-1"):
77
78
                        awnserSheet.question4()
78
79
                else:
79
 
                        awnserSheet.addToSqlString(q)
 
80
                        awnserSheet.addToSqlString(int(q))
80
81
                
81
82
        
82
83
        def question5():
86
87
                if(q == "-1"):
87
88
                        awnserSheet.question5()
88
89
                else:
89
 
                        awnserSheet.addToSqlString(q)
 
90
                        awnserSheet.addToSqlString(int(q))
90
91
                
91
92
        
92
93
        def question6():
96
97
                if(q == "-1:"):
97
98
                        awnserSheet.question6()
98
99
                else:
99
 
                        awnserSheet.addToSqlString(q)
 
100
                        awnserSheet.addToSqlString(int(q))
100
101
                
101
102
        
102
103
        def question7():
106
107
                if(q == "-1"):
107
108
                        awnserSheet.question7()
108
109
                else:
109
 
                        awnserSheet.addToSqlString(q)
 
110
                        awnserSheet.addToSqlString(int(q))
110
111
                
111
112
        
112
113
        def question8():
113
 
                print("Fråga 9:")
 
114
                print("Fråga 8:")
114
115
                print("Tror du att vi varit på månen?")
115
116
                q = awnserSheet.qinput()
116
117
                if(q == "-1"):
117
118
                        awnserSheet.question8()
118
119
                else:
119
 
                        awnserSheet.addToSqlString(q)
 
120
                        awnserSheet.addToSqlString(int(q))
120
121
                
121
122
        
122
123
        def question9():
123
 
                print("Fråga 10:")
 
124
                print("Fråga 9:")
124
125
                print("Motionerar du regelbundet?")
125
126
                q = awnserSheet.qinput()
126
 
                if(q == " -1"):
 
127
                if(q == "-1"):
127
128
                        awnserSheet.question9()
128
129
                else:
129
 
                        awnserSheet.addToSqlString(q)
 
130
                        awnserSheet.addToSqlString(int(q))
130
131
                
131
132
        
132
133
        def question10():
133
134
                print("Fråga 10:")
134
135
                print("Anser du att du har en sund livsstil?")
135
136
                q = awnserSheet.qinput()
136
 
                if(q == " -1"):
 
137
                if(q == "-1"):
137
138
                        awnserSheet.question10()
138
139
                else:
139
 
                        awnserSheet.addToSqlString(q)
 
140
                        awnserSheet.addToSqlString(int(q))
140
141
                
141
142
        
142
143
        def question11():
143
144
                print("Fråga 11:")
144
145
                print("Blir du deprimerad/nedstämd på hösten/vintern?")
145
146
                q = awnserSheet.qinput()
146
 
                if(q == " -1"):
 
147
                if(q == "-1"):
147
148
                        awnserSheet.question11()
148
149
                else:
149
 
                        awnserSheet.addToSqlString(q)
 
150
                        awnserSheet.addToSqlString(int(q))
150
151
                
151
152
        
152
153
        def question12():
153
154
                print("Fråga 12:")
154
155
                print("Gillar du snö?")
155
156
                q = awnserSheet.qinput()
156
 
                if(q == " -1"):
 
157
                if(q == "-1"):
157
158
                        awnserSheet.question12()
158
159
                else:
159
 
                        awnserSheet.addToSqlString(q)
 
160
                        awnserSheet.addToSqlString(int(q))
160
161
                
161
162
        
162
163
        def question13():
163
164
                print("Fråga 13:")
164
165
                print("Är du för ett öppet samhälle?")
165
166
                q = awnserSheet.qinput()
166
 
                if(q == " -1"):
 
167
                if(q == "-1"):
167
168
                        awnserSheet.question13()
168
169
                else:
169
 
                        awnserSheet.addToSqlString(q)
 
170
                        awnserSheet.addToSqlString(int(q))
170
171
                
171
172
        
172
173
        def question14():
173
174
                print("Fråga 14:")
174
175
                print("Är du för dödsstraff?")
175
176
                q = awnserSheet.qinput()
176
 
                if(q == " -1"):
 
177
                if(q == "-1"):
177
178
                        awnserSheet.question14()
178
179
                else:
179
 
                        awnserSheet.addToSqlString(q)
 
180
                        awnserSheet.addToSqlString(int(q))
180
181
                
181
182
        
182
183
        def question15():
183
184
                print("Fråga 15:")
184
185
                print("Är du för kvinnors rättigheter?")
185
186
                q = awnserSheet.qinput()
186
 
                if(q == " -1"):
 
187
                if(q == "-1"):
187
188
                        awnserSheet.question15()
188
189
                else:
189
 
                        awnserSheet.addToSqlString(q)
 
190
                        awnserSheet.addToSqlString(int(q))
190
191
                
191
192
        
192
193
        def question16():
193
194
                print("Fråga 16:")
194
195
                print("Är du för abort?")
195
196
                q = awnserSheet.qinput()
196
 
                if(q == " -1"):
 
197
                if(q == "-1"):
197
198
                        awnserSheet.question16()
198
199
                else:
199
 
                        awnserSheet.addToSqlString(q)
 
200
                        awnserSheet.addToSqlString(int(q))
200
201
                
201
202
        
202
203
        def question17():
203
204
                print("Fråga 17:")
204
205
                print("Är du för kvinnors rätt att bestämma över sin egen kropp?")
205
206
                q = awnserSheet.qinput()
206
 
                if(q == " -1"):
 
207
                if(q == "-1"):
207
208
                        awnserSheet.question17()
208
209
                else:
209
 
                        awnserSheet.addToSqlString(q)
 
210
                        awnserSheet.addToSqlString(int(q))
210
211
                
211
212
        
212
213
        def question18():
213
214
                print("Fråga 18:")
214
215
                print("Blir du deprimerad/nedstämd på våren?")
215
216
                q = awnserSheet.qinput()
216
 
                if(q == " -1"):
 
217
                if(q == "-1"):
217
218
                        awnserSheet.question18()
218
219
                else:
219
 
                        awnserSheet.addToSqlString(q)
 
220
                        awnserSheet.addToSqlString(int(q))
220
221
                
221
222
        
222
223
        def question19():
223
224
                print("Fråga 19:")
224
225
                print("Tror du på den vetenskapliga metoden?")
225
226
                q = awnserSheet.qinput()
226
 
                if(q == " -1"):
 
227
                if(q == "-1"):
227
228
                        awnserSheet.question18()
228
229
                else:
229
 
                        awnserSheet.addToSqlString(q)
 
230
                        awnserSheet.addToSqlString(int(q))
230
231
                
231
232
        
232
233
        def question20():
233
234
                print("Fråga 20:")
234
 
                print("""Tror du att evolutionen som beskrivs i den morerna
235
 
                vetenskapen är ursprunget till de många arterna på denna planet?""")
 
235
                print("""Tror du att evolutionen som beskrivs i den mordärna
 
236
vetenskapen är ursprunget till de många arterna på denna planet?""")
236
237
                q = awnserSheet.qinput()
237
 
                if(q == " -1"):
 
238
                if(q == "-1"):
238
239
                        awnserSheet.question18()
239
240
                else:
240
 
                        awnserSheet.addToSqlString(q)
 
241
                        awnserSheet.addToSqlString(int(q))
241
242
                
242
243
        
243
244
        def questionI():
244
245
                print("Fråga I:")
245
246
                print("Är du gäststuderande här i Sverige?")
246
247
                q = awnserSheet.qinput()
247
 
                if(q == " -1"):
 
248
                if(q == "-1"):
248
249
                        awnserSheet.questionI()
249
250
                else:
250
 
                        awnserSheet.addToSqlString(q)
 
251
                        awnserSheet.addToSqlString(int(q))
251
252
                
252
253
        
253
254
        def questionII():
254
255
                print("Fråga II")
255
256
                print("Är du född i Sverige?")
256
257
                q = awnserSheet.qinput()
257
 
                if(q == " -1"):
 
258
                if(q == "-1"):
258
259
                        awnserSheet.questionI()
259
260
                else:
260
 
                        awnserSheet.addToSqlString(q)
 
261
                        awnserSheet.addToSqlString(int(q))
261
262
                
262
263
        
263
264
        def questionIII():
264
265
                print("Fråga III")
265
266
                print("Är en eller båda av dina föreldrar inte födda i Sverige?")
266
267
                q = awnserSheet.qinput()
267
 
                if(q == " -1"):
 
268
                if(q == "-1"):
268
269
                        awnserSheet.questionI()
269
270
                else:
270
 
                        awnserSheet.addToSqlString(q)
 
271
                        awnserSheet.addToSqlString(int(q))
271
272
                
272
273
        
273
274
        def questionCommentry():
304
305
                awnserSheet.questionIII()
305
306
                awnserSheet.questionCommentry()
306
307
                
307
 
                
308
308
                print("\n\n======================== tack och adjöken ^_^ ===================\n\n")
309
309
        
310
310
                return( awnserSheet.sqlStringStart + awnserSheet.sqlString + awnserSheet.sqlStringEnd )