-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython.php
More file actions
221 lines (195 loc) · 7.05 KB
/
python.php
File metadata and controls
221 lines (195 loc) · 7.05 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
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Python Quiz</title>
<style>
#divlogin {
padding-left: 50%;
text-align: left;
margin-top: -90px;
}
#login {
border-radius: 20px;
background-color: #663399;
font-size: large;
color: white;
}
.center {
border-radius: 50px;
display: block;
max-width: 15%;
max-height: 25%;
padding-bottom: -100px;
}
#menu1 {
padding-left: 20px;
padding-top: 20px;
}
.navbar {
font-size: 20px;
color: purple;
}
#practice,
#learn,
#compete,
#internship,
#job ,
#login{
border-radius: 10px;
background-color: plum;
font-size: large;
color: black;
margin-right: 5px;
cursor: pointer;
}
#practice:hover,
#learn:hover,
#compete:hover,
#internship:hover,
#job:hover ,#login:hover{
border: 3px solid black;
color: purple;
background-color: white;
}
.submit:hover {
border: 3px solid black;
color: purple;
background-color: white;
}
input[type=submit],button {
width: 25%;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: 1px solid black;
background-color: purple;
border-radius: 4px;
cursor: pointer;
}
li {
cursor: pointer;
}
</style>
</head>
<body>
<div>
<div>
<a href="home.php"><img src="learnzy.png" class="center"></a>
</div>
<div id="divlogin">
<input id="learn" type="button" value="Learn" onclick="window.location.href='learn.php';">
<input id="practice" type="button" value="Practice" onclick="window.location.href='practice.php';">
<input id="compete" type="button" value="Compete" onclick="window.location.href='compete.php';">
<input id="internship" type="button" value="Internships" onclick="window.location.href='internship.php';">
<input id="job" type="button" value="Jobs" onclick="window.location.href='job.php';">
<?php
if (!isset($_SESSION['islogin'])) {
echo '<button type="submit" id="login"><a style="text-decoration:none;" href="login.php">Log In</a></button>';
echo '<button type="submit" id="login" style="display:none;"><a href="logout.php">Log Out</a></button>';
} else {
echo '<button type="submit" id="login" style="display:none;"><a href="login.php">Log in</a></button>';
echo '<button type="submit" id="login"><a style="text-decoration:none;" href="logout.php">Logout</a></button>';
}
?>
</div>
<div id="menu1">
<br>
<p class="navbar"><a style="text-decoration:none;" href="home.php">Learnzy</a> >> <a
style="text-decoration:none;" href="compete.php">Quiz</a> >> <a style="text-decoration:none;"
href="python.php">Python Quiz</a></p>
<br>
</div>
</div>
<form id="dsa-quiz" onsubmit="return validate()">
<label for="res" id="res"></label><br><br>
<label for="q1">
What is output for <br>
a = ['he', 'she', 'we'] <br>
' '.join(a) <br>
A . ['heshewe'] <br>
B . 'heshewe'<br>
C . ['he she we']<br>
D . 'he she we'</label><br>
<input type="text" id="q1" name="q1"> <br>
<label for="q1" id="q1Err"></label>
<br><br>
<label for="q2">
What is output of following code <br>
x = 2<br>
y = 10<br>
x *= y*x + 1<br>
A . 42<br>
B . 41 <br>
C . 40<br>
D . 39</label><br>
<input type="text" id="q2" name="q2"> <br>
<label for="q2" id="q2Err"></label>
<br><br>
<label for="q3">
In the following options which are python libraries which are used for data analysis and scientific
computations<br>
A . Numpy<br>
B . Scipy<br>
C . Pandas<br>
D . All of the above</label> <br>
<input type="text" id="q3" name="q3"> <br>
<label for="q3" id="q3Err"></label>
<br><br>
<label for="q4">
What is output for min("hello world")<br>
A . e<br>
B . a blank space character<br>
C . w<br>
D . None of the above</label><br>
<input type="text" id="q4" name="q4"> <br>
<label for="q4" id="q4Err"></label>
<br><br>
<input type="submit" class="submit" value="Submit Your Answers">
</form>
<script>
function validate() {
var q1Ans = document.getElementById('q1').value;
var q2Ans = document.getElementById('q2').value;
var q3Ans = document.getElementById('q3').value;
var q4Ans = document.getElementById('q4').value;
var score = 0;
if (q1Ans == 'B' || q1Ans == 'b') {
document.getElementById('q1Err').innerHTML = "=>Answer is Correct";
score++;
}
else {
document.getElementById('q1Err').innerHTML = "=>Answer is Incorrect and Correct answer is B";
}
if (q2Ans == 'A' || q2Ans == 'a') {
document.getElementById('q2Err').innerHTML = "=>Answer is Correct";
score++;
}
else {
document.getElementById('q2Err').innerHTML = "=>Answer is Incorrect and Correct answer is A";
}
if (q3Ans == 'D' || q3Ans == 'd') {
document.getElementById('q3Err').innerHTML = "=>Answer is Correct";
score++;
}
else {
document.getElementById('q3Err').innerHTML = "=>Answer is Incorrect and Correct answer is D";
}
if (q4Ans == 'B' || q4Ans == 'b') {
document.getElementById('q4Err').innerHTML = "=>Answer is Correct";
score++;
}
else {
document.getElementById('q4Err').innerHTML = "=>Answer is Incorrect and Correct answer is B";
}
document.getElementById('res').innerHTML = score;
return false;
}
</script>
</body>
</html>