Categories
Mastering Development

How to find the length/interval between two alphabets in reverse order?

I have a list of paired strings. I want to find the length/interval between two alphabets. So far I’m able to find the interval for ordered alphabets using alpha =["AM", "KQ", "ZN", "XM", "UK"] length = [] for i in alpha: length.append(len([chr(k) for k in range(ord(i[0]),ord(i[1]))])) print(length) [12] [12, 6] [12, 6, 0] [12, 6, […]

Categories
Mastering Development

In a group of objects Segment doesn’t move

I am a new commer to jsxgraph. I will have many questions. My first graph is the followingenter image description here Here is what I have been able to code. > <div id="box" class="jxgbox" style="width:500px; height:500px;"> > <script type="text/javascript"> var board = > JXG.JSXGraph.initBoard(‘box’, {boundingbox: [0, 10, 10, 0], > axis:false}); var grid = board.create(‘grid’, […]

Categories
Mastering Development

Creating custom/more distance of ticks x axis in ggplot R

Please find my code below: packages <- c("ggplot2", "dplyr", "quantreg", "officer","tidyverse","here","glue","rvg","viridis","scales") install.packages(setdiff(packages, rownames(installed.packages()))) lapply(packages, require, character.only = TRUE) data <- read.csv(file=’Spiderplot_data.csv’, header=TRUE) Progressed <- as.factor(data$Progression) Response <- as.factor(data$X) Response <- factor(data$X, levels = c("Progressive Disease", "Stable Disease", "Partial Response", "Complete Response")) highlight_df <- filter(data, Progression == 1) p <- ggplot() + geom_line( data, mapping = […]

Categories
Mastering Development

How can we Sort a dictionary

As a part of key I am storing a List and in Value I want to store max and min values of that list. Later there will be many lists like that. I need to sort for the dictionary having minimum possible maximum element value and minimum possible minimum element value Something like var map= […]

Categories
Mastering Development

Javascript function to find the mode of a list of numbers

function findMode(list) { var maxIndex = 0; var newIndex = 0; var number = 0; var mode = 0; for (var i = 0; i < list.length; i++) { number = list[i]; for (var x = 0; x < list.length; x++) { if (number == list[x]) { newIndex++; } console.log((number + “=”) + newIndex); } […]

Categories
Mastering Development

I need to pass a user input variable as this list eg: [1, 3, 6, 4, 1, 2] in below python program. Could some one help me

def solution(A): sortedset= set(sorted(A)) sol=1 #for i in sortedset print(sortedset) for i in sortedset: if i == sol: sol+=1 else: break print(sol) A = input() solution(A) #A = [1, 3, 6, 4, 1, 2] ”While passing A = input() and input [1,3,6,4,1,2] not getting expected output ‘5’ but if I give instead of user input […]

Categories
Mastering Development

indexing rows and columns in numpy

a = np.array(list(range(16).reshape((4,4)) array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11], [12, 13, 14, 15]]) Say I want the middle square. It’d seem reasonable to do this: a[[1,2],[1,2]] but I get this: array([5, 10]) This works, but seems inelegant: a[[1,2],:][:,[1,2]] array([[5, 6], [9, 10]]) So my questions are: […]

Categories
Mastering Development

How do you create a long number from a List

How do you create a long number from a List<Integer> ? From: List<Integer> ints = Arrays.asList(1,2,3,4,5,6,7,8,9) TO: long = 1234567489 Thanks

Categories
Mastering Development

Please explain the output of following C program

What will be the output of the below piece of code and why? #include <stdio.h> int main() { int x = (2,6,8); printf("%d",x); return 0; }

Categories
Mastering Development

How to add limited hints when programming a quiz?

I am making a trivia quiz that allows users to solve 10 trivia questions and get a score. I am planning to provide the users 3 hints and print out Sorry! You used all the hints. when the user uses all 3 hints. How do I do that? I know I would need to use […]