Skip to content

Commit 3200fc1

Browse files
authored
Merge branch 'testing' into dev
2 parents 5521e9a + 6dd00ac commit 3200fc1

File tree

12 files changed

+426
-30
lines changed

12 files changed

+426
-30
lines changed

.DS_Store

10 KB
Binary file not shown.

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1-
## Introduction
1+
## Round 0
22

3-
4-
<b>Discipline | <b>Fill your discipline name here
3+
<b>Discipline | <b>Computer Science
54
:--|:--|
6-
<b> Lab | <b> Fill your lab name here
7-
<b> Experiment| <b> Fill your experiment name and number here
8-
9-
### About the Experiment
5+
<b>Lab</b> | <b>Python Programming Lab</b>
6+
<b>Experiment</b>| <b>Strings</b>
107

11-
Fill a brief description of this experiment here
8+
<h5> About the Experiment : </h5>
9+
To teach the basics of Strings using an interactive simulator. Initially, we have a task that will help
10+
user to recall his knowledge about Strings and then an interactive
11+
representation through the simulator that will the help user to enhance his/her concepts.<br><br>
1212

13-
<b>Name of Developer | <b> Fill the name of experiment owner here
13+
<b>Name of Developer | <b> Dr. Aparna Dixit
1414
:--|:--|
15-
<b> Institute | <b>
16-
<b> Email id| <b>
17-
<b> Department |
15+
Institute | Pranveer Singh Institute Of Technology, Kanpur, Uttar Pradesh
16+
Email id| garima002@gmail.com
17+
Department | Basic Science and Humanities(Assistant Professor)
18+
1819

19-
### Contributors List
20+
#### Contributors List
2021

2122
SrNo | Name | Faculty or Student | Department| Institute | Email id
2223
:--|:--|:--|:--|:--|:--|
23-
1 | . | . | . | . | .
24-
2 | . | . | . | . | .
24+
1 | Dr. Aparna Dixit | Faculty | Basic Science and Humanities(Assistant Professor) | Pranveer Singh Institute Of Technology, Kanpur, Uttar Pradesh | garima002@gmail.com
25+
2 | Yash Srivastava | Student | Dept. of Information Technology | Pranveer Singh Institute Of Technology, Kanpur, Uttar Pradesh | officialyash2616@gmail.com
26+
3 | Pawan Yadav | Student | Dept. of Information Technology | Pranveer Singh Institute Of Technology, Kanpur, Uttar Pradesh | pkpawan954@gmail.com
27+
4 | Sumit Yadav | Student | Dept. of Computer Science and Engineering | Pranveer Singh Institute Of Technology, Kanpur, Uttar Pradesh | sumityadav2408@gmail.com
28+
5 | Suryansh Tripathi | Student | Dept. of Computer Science and Engineering | Pranveer Singh Institute Of Technology, Kanpur, Uttar Pradesh | suryansh1004@gmail.com

experiment/.DS_Store

6 KB
Binary file not shown.

experiment/README.md

Lines changed: 206 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,206 @@
1-
### README
1+
### Aim
2+
3+
In this experiment, user will learn the concepts of string in Python programming language.
4+
To implement the operations that can be performed in a string.
5+
6+
### Theory
7+
8+
9+
<h3>String</h3>
10+
We can access a string using indexing. In a string each character is assigned with a unique index value which starts from 0. A string can be written in both single quotes and double quotes.
11+
Example : 'Hello World'<br>
12+
"Hello World"<br>
13+
s = "Hello World"<br>
14+
15+
Python allows negative indexing as well.
16+
Example : -1, -3, -5.
17+
Where -1 refers to the last index, -2 refers to second last index and so on.
18+
Printing here can be done by placing the string in single or double quotes after print.
19+
<br>
20+
print("Hello World")<br><br>
21+
22+
<h4>Concatenation</h4>
23+
A string in python is immutable i.e. it can not be changed once defined. But concatenation is still possible<br>
24+
s = 'Hello World'<br>
25+
s = s +"Example<br>
26+
Now the string will be as "Hello WorldExample".<br>
27+
<h4>Repetition</h4>This is a unique property of strings in Python programming language. When a string is multiplied with an integer, the characters of string are multiplied the same number of times.
28+
29+
Syntax : string*integer<br>
30+
s="k"<br>
31+
s=s*5<br>
32+
Now the string will be "kkkkk". It has repeated itself 5 times.<br>
33+
<h4>Slicing</h4>Slicing is done in Python to select or display the desired number of characters in a string. It is done with the help of symbol ':'.
34+
35+
Syntax : String[ index: ]
36+
<br>
37+
s="Hello World"<br> 1) s = s[2:]<br>
38+
39+
2. s = s[1:8]<br>
40+
Here the 1st example will give output "llo World". All the characters from and after second index is selected.
41+
In the 2nd example output will be "ello Wo". Characters between index number 1 and 8 are selected.
42+
43+
Length of a string can be calculated using the len function.
44+
Syntax : len("string")<br>
45+
len("Hello World"<br>
46+
It will return 11.<br>
47+
48+
### Procedure
49+
50+
<h4>Steps of simulator </h4><br>
51+
1.&nbsp;Select the problem.<br>
52+
2.&nbsp; Read the simulator details.<br>
53+
3.&nbsp;Enter the desired input you want to operate.<br>
54+
4.&nbsp; Press CALCULATE to proceed. <br>
55+
5.&nbsp;The code will be displayed <br>
56+
6.&nbsp;Press NEXT to see the execution of code. <br>
57+
7.&nbsp;Relevant line in the code will be highlighted.<br>
58+
8.&nbsp;The local variables will be shown in the Output Panel with their values.<br>
59+
60+
### Pre Test
61+
62+
1. Q.1 What is the output of the following code?
63+
str1="Virtual PythonLab"
64+
str1[3]='s'
65+
print(str1)
66+
<br>
67+
A.<input type="radio" name="but" id="rb11" onclick="click1();">&nbsp;Virtual Python Lab
68+
<br>
69+
B.<input type="radio" name="but" id="rb12" onclick="click1();">&nbsp;Virtual
70+
<br>
71+
C.<input type="radio" name="but" id="rb13" onclick="click1();">&nbsp;Error
72+
<br>
73+
D.<input type="radio" name="but" id="rb14" onclick="click1();">&nbsp;Virsual Python Lab
74+
<br>
75+
<p id = "p1"></p>
76+
<br>
77+
2. What is the output of given string??
78+
str1="Virtual"
79+
str2="Python"
80+
str3=str1+str2
81+
print(len(str3))
82+
<br>
83+
A. <input type="radio" name="but2" id="rb21" onclick="click2();">&nbsp;10
84+
<br>
85+
B. <input type="radio" name="but2" id="rb22" onclick="click2();">&nbsp;11
86+
<br>
87+
C. <input type="radio" name="but2" id="rb23" onclick="click2();">&nbsp;12
88+
<br>
89+
D. <input type="radio" name="but2" id="rb24" onclick="click2();">&nbsp;13
90+
<br><br>
91+
<p id = "p2"></p>
92+
<br>
93+
94+
3. What arithmetic operators cannot be used with strings?
95+
<br>
96+
A. <input type="radio" name="but4" id="rb41" onclick="click4();">&nbsp;+
97+
<br>
98+
B. <input type="radio" name="but4" id="rb42" onclick="click4();">&nbsp;*
99+
<br>
100+
C. <input type="radio" name="but4" id="rb43" onclick="click4();">&nbsp;-
101+
<br>
102+
D. <input type="radio" name="but4" id="rb44" onclick="click4();">&nbsp;All of the mentioned
103+
<br><br>
104+
<p id = "p4"></p>
105+
<br>
106+
4. What is th output of "virtual"+1+2+"python"
107+
<br>
108+
A. <input type="radio" name="but3" id="rb31" onclick="click3();">&nbsp;vitual3python
109+
<br>
110+
B. <input type="radio" name="but3" id="rb32" onclick="click3();">&nbsp;Error
111+
<br>
112+
C. <input type="radio" name="but3" id="rb33" onclick="click3();">&nbsp;virtual12python
113+
<br>
114+
D. <input type="radio" name="but3" id="rb34" onclick="click3();">&nbsp;virtualpython
115+
<br><br>
116+
<p id = "p3"></p>
117+
<br>
118+
5. 5 If y="123"what will be the the return type of type(y)?
119+
<br>
120+
A.<input type="radio" name="but" id="rb11" onclick="click1();">&nbsp;str
121+
<br>
122+
B.<input type="radio" name="but" id="rb12" onclick="click1();">&nbsp;int
123+
<br>
124+
C.<input type="radio" name="but" id="rb13" onclick="click1();">&nbsp;bool
125+
<br>
126+
D.<input type="radio" name="but" id="rb14" onclick="click1();">&nbsp;String
127+
<br>
128+
<p id = "p1"></p>
129+
<br>
130+
131+
### Post Test
132+
133+
1. What is the output of the following code?[A]
134+
class customer:
135+
def**init**(self,id):
136+
self.id=str(id)
137+
id="2010"
138+
obj=customer(2567)
139+
print(obj.id)
140+
<br>
141+
A.<input type="radio" name="but" id="rb11" onclick="click1();">&nbsp;. 2567
142+
<br>
143+
B.<input type="radio" name="but" id="rb12" onclick="click1();">&nbsp; Error
144+
<br>
145+
C.<input type="radio" name="but" id="rb13" onclick="click1();">&nbsp; 2010
146+
<br>
147+
D.<input type="radio" name="but" id="rb14" onclick="click1();">&nbsp; None
148+
<br>
149+
<p id = "p1"></p>
150+
<br>
151+
2. What is the output of following Python program?[B]
152+
text='Python is high-level programming language'
153+
words=text.split()
154+
l=len(words)
155+
print('Number of words of the text:%d'%l)
156+
<br>
157+
A. <input type="radio" name="but2" id="rb21" onclick="click2();">&nbsp; Error
158+
<br>
159+
B. <input type="radio" name="but2" id="rb22" onclick="click2();">&nbsp;5
160+
<br>
161+
C. <input type="radio" name="but2" id="rb23" onclick="click2();">&nbsp; 6
162+
<br>
163+
D. <input type="radio" name="but2" id="rb24" onclick="click2();">&nbsp;None of these
164+
<br><br>
165+
<p id = "p2"></p>
166+
<br>
167+
168+
3. What is the output when following code is executed?[C]
169+
str1="virtualpythonlab"
170+
print(str1[6::-2])
171+
<br>
172+
A. <input type="radio" name="but4" id="rb41" onclick="click4();">&nbsp;pylab
173+
<br>
174+
B. <input type="radio" name="but4" id="rb42" onclick="click4();">&nbsp; lautriv
175+
<br>
176+
C. <input type="radio" name="but4" id="rb43" onclick="click4();">&nbsp; lurv
177+
<br>
178+
D. <input type="radio" name="but4" id="rb44" onclick="click4();">&nbsp;pati
179+
<br><br>
180+
<p id = "p4"></p>
181+
<br>
182+
183+
4. What is the output of the following code?[D]
184+
defchangement(str1):
185+
char=str1[0]
186+
str1=str1.replace(char,'&')
187+
str1=char+str1[1:]
188+
returnstr1
189+
print(changement('this is the string'))
190+
<br>
191+
A. <input type="radio" name="but3" id="rb31" onclick="click3();">&nbsp;Syntax Error
192+
<br>
193+
B. <input type="radio" name="but3" id="rb32" onclick="click3();">&nbsp;this is the string
194+
<br>
195+
C. <input type="radio" name="but3" id="rb33" onclick="click3();">&nbsp;&his is &hes &tring
196+
<br>
197+
D. <input type="radio" name="but3" id="rb34" onclick="click3();">&nbsp;this is &he s&tring
198+
<br><br>
199+
<p id = "p3"></p>
200+
<br>
201+
202+
### References
203+
204+
<p style="font-size:100%; margin-top:2%">
205+
<br>
206+
www.learnpython.org/en/Basic_String_Operations

experiment/details.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
3+
"details": [
4+
{
5+
"Experiment": "String", // Write your experiment name inside the quotes
6+
"Lab": "Python Programming Lab", // Write your lab name inside the quotes
7+
"Discipline": "Computer Science", // Write discipline name to which experimet belongs inside the quotes
8+
"Technology": "Python" // Write technologies used inside the quotes
9+
}
10+
],
11+
12+
"developer": [
13+
{
14+
"Developer": "Dr. Aparna Dixit", // Write the name of the developer inside the quotes
15+
"Institute": "Pranveer Singh Institute of Technology", // Write your institute name inside the quotes
16+
"InstituteAcronym": "P.S.I.T." // Write acronym of the institute inside the quotes
17+
}
18+
],
19+
20+
"contributer": [
21+
{
22+
"Contributer": "Yash Srivastava", // Write the name of the first contributer inside the quotes
23+
"Institute": "Pranveer Singh Institute of Technology", // Write your institute name inside the quotes
24+
"InstituteAcronym": "P.S.I.T." // Write acronym of the institute inside the quotes
25+
},
26+
27+
{
28+
"Contributer": "Pawan Yadav", // Write the name of the second contributer inside the quotes
29+
"Institute": "Pranveer Singh Institute of Technology", // Write your institute name inside the quotes
30+
"InstituteAcronym": "P.S.I.T." // Write acronym of the institute inside the quotes
31+
},
32+
33+
{
34+
"Contributer": "Sumit Yadav", // Write the name of the third contributer inside the quotes
35+
"Institute": "Pranveer Singh Institute of Technology", // Write your institute name inside the quotes
36+
"InstituteAcronym": "P.S.I.T." // Write acronym of the institute inside the quotes
37+
},
38+
39+
{
40+
"Contributer": "Suryansh Tripathi", // Write the name of the fourth contributer inside the quotes
41+
"Institute": "Pranveer Singh Institute of Technology", // Write your institute name inside the quotes
42+
"InstituteAcronym": "P.S.I.T." // Write acronym of the institute inside the quotes
43+
}
44+
]
45+
46+
}

experiment/images/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

experiment/institute.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#### Pranveer Singh Institute of Technology

experiment/lab-name.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
## Python Programming Lab

experiment/posttest.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
"question": "What is the output of the following code?",
33
"code": "class customer:\n def __init__(self, id):\n self.id = str(id)\nid = '2010'\nobj = customer(2567)\nprint(obj.id)",
44
"answers": {
5-
"a": "2567",
6-
"b": "Error",
7-
"c": "2010",
8-
"d": "None"
5+
"a": "2567",
6+
"b": "Error",
7+
"c": "2010",
8+
"d": "None"
99
},
1010
"correctAnswer": "a"
1111
}, {
1212
"question": "What is the output when the following code is executed?",
13-
"code": "str1 = 'virtualpythonla'\nprint(str1)",
13+
"code": "str1 = 'virtualpythonla'\nprint(str1)",
1414
"answers": {
15-
"a": " pylab",
16-
"b": "lautriv",
17-
"c": "lurv",
18-
"d": "pati"
15+
"a": "dlrowolleh",
16+
"b": "hello",
17+
"c": "world",
18+
"d": "helloworld"
1919
},
20-
"correctAnswer": "c"
20+
"correctAnswer": "a"
2121
}, {
2222
"question": "What is the output of the following Python program?",
23-
"code": "text = 'Python is high-level programming language'\nwords = text.split()\nl = len(words)\nprint('Number of words of the text: %d' % l)",
24-
"answers": {
23+
"code": "text = 'Python is high-level programming language'\nwords = text.split()\nl = len(words)\nprint('Number of words of the text: %d' % l)",
24+
"answers": {
2525
"a": " Error",
2626
"b": " 5",
2727
"c": "6",

0 commit comments

Comments
 (0)