1) Convert the string, s = "12345" to list.
s = "12345"
l = list(s)
print(l)
>>> ["1", "2", "3", "4", "5"]
l = list(s)
print(l)
>>> ["1", "2", "3", "4", "5"]
2) Difference between list and tuple?
3) What is set?
4) Difference between function overriding and overloading?
5) What is Python Design patterns?
6) What is multi-threading?
7) Convert the each element of a list, l = [1, 2, 3, 4, 5] to it's squares.
l = [1, 2, 3, 4, 5]
l = [x * x for x in l]
print(l)
>>> [1, 4, 9, 16, 25]
l = [x * x for x in l]
print(l)
>>> [1, 4, 9, 16, 25]
8) Read your resume file and count the number of capital words in it.
import re
l = []
with open("resume.txt", "r") as fh:
for line in fh:
w = re.findall(r"[a-zA-Z]{2,}", line)
l.extend(w)
l = list(set(l))
print(len(l))
l = []
with open("resume.txt", "r") as fh:
for line in fh:
w = re.findall(r"[a-zA-Z]{2,}", line)
l.extend(w)
l = list(set(l))
print(len(l))
9) How do you design a python automation framework for the below requirements:
a) Test suite should run with given criteria.
b) Send the report to the email addresses.
10) Generate the valid IP Address for the range between "100.100.0.0" to "100.100.198.198".
Ex: "100.100.0.0" to "100.100.0.198"
"100.100.1.0" to "100.100.1.198"
"100.100.2.0" to "100.100.2.198"
ip = "100.100"
l = [ ]
for i in range(199):
s = ip + "." + str(i)
for j in range(199):
p = s + "." + str(j)
l.append(p)
print(l)
>>> '100.100.0.0' to '100.100.198.198'
l = [ ]
for i in range(199):
s = ip + "." + str(i)
for j in range(199):
p = s + "." + str(j)
l.append(p)
print(l)
>>> '100.100.0.0' to '100.100.198.198'
Good Collection Of Python question..
ReplyDeletejava courses in pune
java classes in pune
best java classes in pune
Core java classes in pune
java training institute in pune
java certification course in pune
Java Training in Pune
Java Training in Pune with Placement
dot net classes in pune
dot net course in pune
Best dot net training institute in pune
dot net training in pune