Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
likorn
/
iax0583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
785a74f5
authored
Oct 01, 2017
by
likorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
a3dc1170
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
lab4/task3.py
lab4/task3.py
0 → 100644
View file @
785a74f5
list1
=
[]
print
(
"Please write 5 lines"
)
for
x
in
range
(
1
,
6
):
list1
.
append
(
input
(
str
(
x
)
+
' line: '
))
to_remove
=
input
(
"
\n
Please tell us which line you want to remove
\n
"
)
list1
.
remove
(
to_remove
)
to_front
=
input
(
"
\n
Now write a line, we'll add it in front of the list
\n
"
)
list1
.
insert
(
0
,
to_front
)
many_words
=
[]
for
x
in
range
(
0
,
len
(
list1
)):
for
letter
in
range
(
0
,
len
(
list1
[
x
])):
if
list1
[
x
][
letter
]
==
' '
:
many_words
.
append
(
list1
[
x
]
.
split
(
' '
))
break
print
(
"
\n
Now we'll separate the lines with many words"
)
for
y
in
range
(
0
,
len
(
many_words
)):
for
m
in
range
(
0
,
len
(
many_words
[
y
])):
print
(
many_words
[
y
][
m
])
string
=
''
variable
=
input
(
"Type something, please, we wanna store it
\n
"
)
reversed_var
=
[
''
]
*
len
(
variable
)
for
letter
in
range
(
0
,
len
(
variable
)
//
2
):
temporary
=
variable
[
letter
]
reversed_var
[
letter
]
=
variable
[
len
(
variable
)
-
1
-
letter
]
reversed_var
[
len
(
variable
)
-
1
-
letter
]
=
temporary
print
(
string
.
join
(
reversed_var
))
if
len
(
variable
)
%
2
==
1
:
reversed_var
[
len
(
variable
)
//
2
]
=
variable
[
len
(
variable
)
//
2
]
print
(
string
.
join
(
reversed_var
))
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