Case Conversion
Given a string in camel case, write a python program to convert the given string from camel case to snake case.Input
The input will be a single line contain a string.Output
The output should contain the given word in snake case.Explanation
For example, if the given word is "Python Learning" in camel case, your code should print given word in snake case "python_learning".
Sample Input 1
Python Learning
Sample Output 1
Python_learning
Write a program to check the overlapping of one string's suffix with the prefix of another string.
Input
The first line of the input will contain a string A.
The second line of the input will contain a string B.
Output
The output should contain overlapping word if present else print "No overlapping".
Explanation
For example, if the given two strings, A and B, are "ramisgood" "goodforall"
The output should be "good" as good overlaps as a suffix of the first string and prefix of next
You are required to create a console application that will capture a customer number and determine the value of the customers coin portfolio. The application must capture the customer number and the amount of silver, gold and platinum coins in a customer's portfolio.
Evaluate each of the following expressions and list the final value of variable x.
1) x = 4-(8%5)*3/(8-6)%3;
2) x = ((9%8)*2)*8/5%(7/3)
3)x= (5-2*9+(3+((9/4)%2*3+6/(8%3))))
4)x =3/6+13%3+2
1.Write a function using C++ statements called AverageValue() which takes two integer values(value1,value2) and returns the average value as a float.
2.Write function using C++ statements called MaximumOutlet() which takes two integer values(value1,value2 )and returns the highest value.
3.Consider the following to answer the questions that follow.
RFC is one of the most popular food and grocery retailers. The company weekly record transaction details of a product over (four) 4 outlets.
The transaction code is a 4 – digit number and starts with 21. The last 2 digits indicate the quantity sold of the product.
Write a function using C++ statements called ProcessTransactions() which takes two 2 integer arrays (array 1,array2) and an integer as the size of the array 1.
Array 1 holds all transaction details while array2 holds the product quantity details after processing.
The function should use transaction details in array1 and store the quantity values in the array2.
Note: quantity is a 2-digit integer.
Write only the loop statements to print the following sequence .
1) 1 2 4 8 16
2) 1 2 4 6 10 15
3) 243 81 27 9
4) 111 222 333 444 555
5) 16 11 7 4 2 1
6) 1 1 2 3 5 8 13 21
Given two polynomials A and B, write a program that adds the given two polynomials A and B.
input:
4
0 5
1 0
2 10
3 6
4
0 -5
1 0
2 -10
3 -6
expected output:
your output:
(nothing)
input:
4
0 5
1 0
2 10
3 6
3
0 1
1 2
2 4
output:
6x^3 + 14x^2 + 2x + 6
Errors/Warnings:
Traceback (most recent call last):
File "main.py", line 69, in <module>
a = input_polinom()
File "main.py", line 2, in input_polinom
n = int(input())
EOFError: EOF when reading a line
expected output:
6x^3 + 14x^2 + 2x + 6
How to convert the string from camel case to snake case using iterate over the words and using string slicing approximately
def max_sub_list(l:list):
if len(l) == 0:
print(0)
else:
max_sum = l[0]
for i in range(len(l)):
for j in range(i, len(l)):
if sum(l[j-i:j+1]) > max_sum:
max_sum = sum(l[j-i:j+1])
print(max_sum)
while True:
try:
arr = list(map(int,input().split()))
except ValueError:
continue
max_sub_list(arr)
Output:6
Traceback (most recent call last):
File "main.py", line 13, in <module>
arr = list(map(int,input().split()))
EOFError: EOF when reading a line
Can anyone give correct code
Summary
Code
DESCRIPTION
DISCUSS
Max Contiguous Subarray
Given a list of integers, write a program to identify the contiguous sub-list that has the largest sum and print the sum. Any non-empty slice of the list with step size 1 can be considered as a contiguous sub-list.
Input
The input will contain space-separated integers, denoting the elements of the list.
Output
The output should be an integer.
Explanation
For example, if the given list is [2, -4, 5, -1, 2, -3], then all the possible contiguous sub-lists will be,
[2]
[2, -4]
[2, -4, 5]
[2, -4, 5, -1]
[2, -4, 5, -1, 2]
[2, -4, 5, -1, 2, -3]
[-4]
[-4, 5]
[-4, 5, -1]
[-4, 5, -1, 2]
[-4, 5, -1, 2, -3]
[5]
[5, -1]
[5, -1, 2]
[5, -1, 2, -3]
[-1]
[-1, 2]
[-1, 2, -3]
[2]
[2, -3]
[-3]
Among the above contiguous sub-lists, the contiguous sub-list [5, -1, 2] has the largest sum which is 6.