Summer Holiday HW XII CS 2024-25
Summer Holiday HW XII CS 2024-25
for c in range(1,6,2):
times = times + c
alpha = alpha + data [c-1] + "@"
add = add + data[c]
print (times, add, alpha)
10 Predict the output of the Python code given below:
L=[1,2,3,4,5]
Lst=[]
for i in range(len(L)):
if i%2==1:
t=(L[i],L[i]**2)
Lst.append(t)
print(Lst)
# Repeatedly compute
# power of x
pow = 1
while (pow < y):
pow = pow * x
# Check if power of x
# becomes y
return (pow == y)
# A temporary array to
# store all combination
# one by one
data = [0]*r;
string = "GeekforGeeks!"
vowels = "aeiouAEIOU"
import random
import string
def strong_level_pass(n):
# Random character generation
print("Strong level password: ", end="")
for i in range(n):
# Random special characters or digits
print(random.choice(string.ascii_letters + string.digits + string.punctuation), end="")
print()
def maxDepth(s):
count = 0
st = []
for i in range(len(s)):
if (s[i] == '('):
st.append(i) # pushing the bracket in the stack
elif (s[i] == ')'):
if (count < len(st)):
count = len(st)
# keeping track of the parenthesis and storing
# it before removing it when it gets balanced
st.pop()
return count
import re
if len(tokens) != 4:
return False
if len(token) == 0:
return False
return True
42. Create a function that finds the smallest missing positive integer in a list.
43. Write a function to find the longest common subsequence between two strings.
44. Implement a function to remove all occurrences of a specific element from a list