Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taskB_inlab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
group18
taskB_inlab
Commits
e41753ef
Commit
e41753ef
authored
Aug 24, 2016
by
SHRADDHEYA SHENDRE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding task1.py (B1)
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
task1.py
task1.py
+40
-0
No files found.
task1.py
0 → 100644
View file @
e41753ef
def
function1
(
str1
,
str2
,
olist
):
l1
=
len
(
str1
)
l2
=
len
(
str2
)
l
=
min
(
l1
,
l2
)
newlist
=
[(
str1
[
x
],
str2
[
x
])
for
x
in
range
(
l
)]
final
=
olist
+
newlist
return
final
;
list1
=
[
"H"
,
"E"
,
"L"
,
"L"
,
"O"
]
pass1
=
"Mathematician"
pass2
=
"Cheerful"
returned
=
function1
(
pass1
,
pass2
,
list1
)
print
(
list1
)
print
(
returned
)
# This is the one with for loops :
"""
def function1(str1,str2,olist):
l1 = len(str1)
l2 = len(str2)
l = min(l1,l2)
newlist = []
for x in range(len(olist)):
newlist.append(olist[x])
for x in range(l):
newlist.append((str1[x],str2[x]))
return newlist;
list1 = ["H","E","L","L","O"]
pass1 = "Mathematician"
pass2 = "Cheerful"
returned = function1(pass1,pass2,list1)
print(list1)
print(returned)
"""
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment