Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bhanu Prasad Marri
internship
Commits
9ecb65d3
Commit
9ecb65d3
authored
Jun 12, 2019
by
Bhanu Prasad Marri
☯
Browse files
Upload New File
parent
248c5ae4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Team_5_Python_Tasks.py
0 → 100644
View file @
9ecb65d3
#!/usr/bin/env python
# coding: utf-8
# In[3]:
#1
N
=
int
(
input
(
"Enter the value of N
\t
"
))
print
(
"Entered Number is "
+
str
(
N
))
if
N
<=
21
:
print
(
"The difference between 21 and "
+
str
(
N
)
+
" is
\t
"
+
str
(
21
-
N
)
)
else
:
print
(
"The Double of difference between "
+
str
(
N
)
+
"and 21 is: "
)
print
(
2
*
(
N
-
21
))
# In[22]:
#2
n
=
float
(
input
(
"Enter a Number"
))
if
n
<=
100
and
100
-
n
<
10
:
print
(
"TRUE"
)
elif
n
<=
200
and
200
-
n
<=
10
:
print
(
"TRUE"
)
else
:
print
(
"False"
)
# In[21]:
#6
even
=
[]
odd
=
[]
n
=
int
(
input
(
"Enter Range
\t
"
))
for
i
in
range
(
n
+
1
):
if
i
%
2
==
0
:
even
.
append
(
i
)
else
:
odd
.
append
(
i
)
print
(
even
)
print
(
odd
)
t
=
len
(
even
)
q
=
len
(
odd
)
print
(
"No. of Even Numbers
\t
"
+
str
(
t
))
print
(
"NO. of odd Numbers
\t
"
+
str
(
q
))
# In[18]:
#7
stri
=
(
input
(
"Enter comma separated integers: "
))
print
(
"Input string: "
,
stri
)
list
=
stri
.
split
(
","
)
print
(
"list: "
,
list
)
li
=
stri
.
split
(
","
)
print
(
"tuple :"
,
tuple
(
li
))
# In[23]:
#3
a
=
str
(
input
(
"ENTER ANY STRING
\t
"
))
n
=
int
(
input
(
"Enter the index value to be removed
\t
"
))
t
=
len
(
a
)
if
n
<=
t
-
1
:
b
=
""
for
i
in
range
(
t
):
if
i
==
n
:
continue
else
:
b
=
b
+
a
[
i
]
print
(
b
)
else
:
print
(
"The Index Value is out of Range. Please Check."
)
# In[25]:
#4
x
=
float
(
input
(
"Enter First Value
\t
"
))
y
=
float
(
input
(
"Enter Second Number
\t
"
))
if
x
==
y
:
print
((
2
*
x
)
**
2
)
else
:
print
(
x
+
y
)
# In[26]:
#5
a
=
str
(
input
(
"Enter a String"
))
n
=
int
(
input
(
"Enter the number of times it is to be repeated"
))
print
(
a
*
n
)
# In[30]:
#9
import
datetime
currentDT
=
datetime
.
datetime
.
now
()
print
(
currentDT
)
# In[28]:
#10
x
=
float
(
input
(
"Enter First Number
\t
"
))
y
=
float
(
input
(
"Enter Second Number
\t
"
))
if
x
==
10
or
y
==
10
:
print
(
"TRUE"
)
elif
x
+
y
==
10
:
print
(
"True"
)
else
:
print
(
"FALSE"
)
# In[33]:
#8
stri
=
(
input
(
"Enter comma separated integers: "
))
print
(
"Input string: "
,
stri
)
even
=
[]
odd
=
[]
Write
Preview
Supports
Markdown
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