range

Range check feedback in Python

Range check feedback in Python Question: For an assignment for school, I’ve got to come up with a code breaker that follows certain rules. Code is 4 numbers. (not random) I can’t use functions/lists/arrays. Only loops. Implement a stop code. (9999) Every step of the way the user needs to get feedback. Feedback includes, but …

Total answers: 3

Generating a list of tuples between a range of values

Generating a list of tuples between a range of values Question: I’d like to define a function that takes in a list of integers, such as [3, 2, 2], and outputs a list of the following tuples, sorted in this order (from least to greatest). The first element ranges from 0..2, since the first element …

Total answers: 2

Python function with cache give me an error, but why?

Python function with cache give me an error, but why? Question: I have the task to write a program with a function, that takes 2 integer and returns the numbers between the 2 integers. Example calc_range(3,5) -> 3,4. The function should save the data in a cache, for the reason, that if I ask the …

Total answers: 1

How to convert a string to an integer class within a python function?

How to convert a string to an integer class within a python function? Question: In a python function, I have defined two variables as letters. def Vandermonde(x, d): x_0=-1 a = np.arange(d) I am getting the error that "d"is not defined in a = np.arange(d). I suspect, but could be wrong, that this is because …

Total answers: 1

How to make my number board start at 1 end at 9 and arrange itself in 3 rows

How to make my number board start at 1 end at 9 and arrange itself in 3 rows Question: I’m trying to understand this code from "12 Beginner Python Projects – Coding Course" on the FreeCodeCamp Youtube channel and I really don’t understand this code to print a board for the Tic Tac Toe project. …

Total answers: 1

How to print without a newline without using end=" "?

How to print without a newline without using end=" "? Question: I need to design a function named firstN that, given a positive integer n, displays on the screen the first n integers on the same line, separated by white space. An example of using the function could be: >>> firstN(10) 0 1 2 3 …

Total answers: 2

trying to split number but list index out of range

trying to split number but list index out of range Question: the problem with this code is that it will come to a point, in line 9 (if a[c+1] != 0:), it will recall an index +3 that does not exist and it will give me the error "list index out of range". a= ‘555101’ …

Total answers: 3

Python – how can I print n numbers per line of range by using for loop?

Python – how can I print n numbers per line of range by using for loop? Question: I have seen some examples of printing numbers per line, but I still didn’t get it:( I’ve tested n but it didn’t show up the result and I don’t know why it won’t work as I’m new to …

Total answers: 4