## Print Function

The included code stub will read an integer, n, from STDIN. Without using any string methods, try to print the following: 123...n Note that "" represents the consecutive values in between. Example: n=5 Print the string 12345. Input Format: The first line contains an integer n. Constraints: 1<=n<=150 Output Format: Print the list of integers from 1 through n as a string, without spaces.

View Solution →## List Comprehensions

Let's learn about list comprehensions! You are given three integers x,y and z representing the dimensions of a cuboid along with an integer i. Print a list of all possible coordinates given by (i,j,k) on a 3D grid where the sum of i+j+k is not equal to n. Here, 0<=i<=x; 0<=j<=y; 0,=k<=z. Please use list comprehensions rather than multiple loops, as a learning exercise. Example: x=1 y=1 z=2 n=3 All permutations of [i,j,k] are: . [[0,0,0], [0,0,1], [0,0,2],

View Solution →## Find Runne-Up Score

Given the participants' score sheet for your University Sports Day, you are required to find the runner-up score. You are given n scores. Store them in a list and find the score of the runner-up. Input Format: The first line contains n. The second line contains an array A[] of n integers each separated by a space. Constraints: 2<=n<=10 -100<=A[i]<=100 Output Format: Print the runner-up score.

View Solution →## Nested Lists

Given the names and grades for each student in a class of N students, store them in a nested list and print the name(s) of any student(s) having the second lowest grade. Note: If there are multiple students with the second lowest grade, order their names alphabetically and print each name on a new line. Example: records=[["chi",20.0], ["beta", 50.0], ["alpha",50.0]] The ordered list of scores is [20.0,50.0] , so the second lowest score is 50.0. There are two students with that s

View Solution →## Finding the Percentage

The provided code stub will read in a dictionary containing key/value pairs of name:[marks] for a list of students. Print the average of the marks array for the student name provided, showing 2 places after the decimal. Example: marks key: value pairs are 'alpha': [20,30,40] 'beta': [30,50,70] query_name = 'beta' The query_name is 'beta'. beta's average score is (20+50+70)/3 = 50. Input Format: The first line contains the integer n, the number of stude

View Solution →