Tip
The formula to calculate the fare per kilometer is,
fare per kilometer = fare / distance
should be a single line containing the fare per kilometer
"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.stdin.on("end", (_) => {
inputString = inputString.trim().split("\n").map((str) => str.trim());
main();
});
function readLine() {
return inputString[currentLine++];
}
/* not modify anything above this line */
function Ride(fare, distance) {
/* Write your code here */
}
/* not modify anything below this line */
function main() {
const fare = JSON.parse(readLine());
const distance = JSON.parse(readLine());
const ride1 = new Ride(fare, distance);
console.log(ride1.getFarePerKilometer());
}
Input1
{'surname' : 'Jones', 'city': 'Los Angeles'}
{'dish': 'puddings'}
{'pet': 'Peter'}
Output1
Mr and Mrs Jones went to a picnic in Los Angeles with a boy and a pet Peter. Mrs Jones made a special dish "puddings"
function readLine() {
return inputString[currentLine++];
}
/* Please do not modify anything above this line */
function main() {
const father = JSON.parse(readLine().replace(/'/g, '"'));
const mother = JSON.parse(readLine().replace(/'/g, '"'));
const child = JSON.parse(readLine().replace(/'/g, '"'));
/* Write your code here */
/* Please do not modify anything below this line */
console.log(`Mr and Mrs ${family.surname} went to a picnic in ${family.city} with a boy and a pet ${family.pet}. Mrs ${family.surname} made a special dish "${family.dish}"`);
}
A sender sends data of length 'l'in the form of digitset to the receiver where a digitset a collection of digits. The sender sends two data d1 and d2 to the receiver. The receive finds the sum of the data. While transmission, the digit in the highest value place of d1
is corrupted as 'm' more than the actual digit.
Note: 'm' is less than the digit in the highest value place
Given the length of the data 'l', data d1, d2 and the value 'm', develop pseudocode and
C++ code to the display the sum of d1 and d2 and the corrected d1 and corrected sum. Overload '+' operator to find the sum of data.
For example, if 'l' is 3 and d1 is 321 and d2 is 996 and 'm' is 1, then the sum is 1317, corrected d1 is 221 and the corrected sum is 1217.
Input format:
Enter the length of the data, I
Next 'l' lines contains digits of d1
Next 'l' lines contains digits of d2
Last line contains 'm'
Output format:
Sum of d1and d2
Next 'l' lines contains corrected data d1
Last line contains corrected sum
Sample Input 1
[ 'book', 'table', 'strawberries', 'lemons' ]
Sample Output 1
[ 'BOOK', 'TABLE', 'STRAWBERRIES', 'LEMONS' ]
input2
[ 'my best friend', 'florida', 'winter' ]
output 2
[ 'MY BEST FRIEND', 'FLORIDA', 'WINTER' ]"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");
let inputString = "";
let currentLine = 0;
process.stdin.on("data", (inputStdin) => {
inputString += inputStdin;
});
process.stdin.on("end", (_) => {
inputString = inputString.trim().split("\n").map((str) => str.trim());
main();
});
function readLine() {
return inputString[currentLine++];
}
/* not modify anything above this line */
function main() {
const myArray = JSON.parse(readLine().replace(/'/g, '"'));
/* Write your code here */
}
let's build a Book Search page Refer to the below image.
https://assets.ccbp.in/frontend/content/dynamic-webapps/book_search_output.gif
achieve functionality.
PLEASE WRITE HTML AND JAVASCRIPT CODE FOR THIS...
Bookmark Maker
let's build a Bookmark Maker
Instructions:
Warning
By following the above instructions, achieve the given functionality.
The rectangular rule (also called the midpoint rule) is perhaps the simplest of the three methods for estimating an integral. i. Integrate over an interval a ≤ x ≤ b. ii. Divide this interval up into n equal subintervals of length h = (b − a)/n. iii.Approximate f in each subinterval by f(x*j ), where x*j is the midpoint of the subinterval. iv. Area of each rectangle: f(x*j)h, f(x*j)h,. . . , f(x*n)h
m, n = input('Enter the values of M and N separated by a space: ').split()
m = int(m)
n = int(n)
matrix_str = input('Enter all matrix values separated by a space: ').split()
matrix = [matrix_str[n*i:n*(i+1)] for i in range(m)]
for i in range(n):
for j in range(i+1):
try:
print(matrix[j][i-j],end=' ')
except:
break
print('')
for i in range(1,m):
for j in range(i+1):
try:
print(matrix[i+j][-1-j],end=' ')
except:
break
print('') In this answer why did we use for i in range(m) while getting matrix
can you please explain to me why we used it like that and can we use it like that
m, n = input('Enter the values of M and N separated by a space: ').split()
m = int(m)
n = int(n)
matrix_str = input('Enter all matrix values separated by a space: ').split()
matrix = [matrix_str[n*i:n*(i+1)] for i in range(m)]
for i in range(n):
for j in range(i+1):
try:
print(matrix[j][i-j],end=' ')
except:
break
print('')
for i in range(1,m):
for j in range(i+1):
try:
print(matrix[i+j][-1-j],end=' ')
except:
break
print('')
In this answer why did we use for i in range(m) while getting the matrix
A shift cipher (a.k.a. Caesar’s cipher) is a simple substitution cipher in which each letter in the plaintext is replaced with another letter that is located a certain number, n, positions away in the alphabet. The value of n can be positive or negative. For positive values, replace letters with letters located n places on its right (i.e. ‘shifted’ by n positions to the right). For negative values, replace letters with letters located n places on its left. If it reaches the end/start of the alphabets, wrap around to the start/end. For example: If n = -3, each letter in the plaintext is replaced with a letter 3 positions before that letter in the alphabet list.