Malvolio Good

@malvoliothegood (728) • Creative Coding NZ
I am not a plastic toy.
🚀 Creating a VueJS app: A tutorial for beginners 👏
posted to Tutorials by eankeen

Good introduction to Vue.js

Purple Rain ☂️!
posted to Share by PowerCoder

Here is something like purple rain except it's raining cats and dogs . The HTML5 canvas and its methods are used:

I dont know to use else!
posted to Ask by AlexIsRapling

Your code needs to be indented and you need a colon after the else.

// If you are looking for John to be entered
print("Enter your name user:")
if input() == "John":
   print("Hi John")
   print("You are not John!")
how i do css
posted to Ask by GAKiaraM

It's a big topic. You will need to find some good tutorials. Here are a few links:

how do i answer this question?
posted to Ask by RossBenson

The division operator ( / ) returns the whole number part of a division. The remainder operator ( // ) returns the remainder part. I won't give you the answer, but here are some clues. Replace the ? marks with the correct operator (or number).

tens = ? / 10
ones = 79 ? 10
I want to switch my technical support job to Data Scientist or Python developer ??
posted to Ask by amar969

Find a job before resigning from your current one!

How can i define the tangent function?
posted to Ask by Thatoneguy130

tan(angle) = sin(angle) / cos(angle)
What language are you wanting to use to graph the function?

How to import a file in
posted to Ask by chidibomaopara

path should be path = r"gun-violence-data-short.csv"

Can someone pls explain this code?
posted to Ask by ZestyLad

Lets track the value of variables when the nt_to_Roman function is called with the input value of 16.
1. The num variable is assigned the value 16
2. The two variables val and syb are declared and initialised along with roman_num and i.
3. The while loop is entered and as num is greater than 0 the body of the while is entered.
4. The expression num // val[i] is evaluated. The // operator is gives an integer division. This means that 4 // 2 => 2, and 5 // 2 is also 2 as the 0.5 remainder is discarded. First time through the loop num // val[i] evaluates to 16 // val[0] => 16 // 1000 => 0. This means the code in the for loop will repeat 0 times.
5. Next the value of i (currently at 0) will be increased by 1 so it's value is 1
6. The code execution will then move back to the top of the loop and num will be compared with 0 and as it is greater execution will pass to the next line of code and num // val[i] will be evaluated. As i is 1 val[i] will be 900 and the expression will be 16 // 900. This gives 0 again, so the for loop will not run and i will increase by 1.
7. Code execution proceeds in this way until 16 // val[i] gives a none zero result. This happens when i is 8 and val[i] is 10 and the expression is 16 // 10 => 1 (remember that the remainder is discarded. Now range(num // val[i]) becomes range(1) meaning the code within the for loop will execute once.
8. roman_num += syb[i] => roman_num += 'X', meaning roman_num chnages from an empty string to X.
9. num -= val[i] => num = num - val[i] => num = 16 - 10 => num = 6
10. i is then increased by 1 and becomes 2
11. Code execution jumps back to the top of the loop and num (value of 6) is tested to see that it is greater than 0. It is.
12. The for loop is then entered. num // val[i] => 6 // 9 => 0. So the for loop does not execute. num // val[i] will be greater than 0 when i is 10 and val[i] is 5.
13. When the for loop code does execute (once): roman_num += syb[i] => roman_num = roman_num + syb[i] => roman_num = 'X' + 'V' => roman_num = 'XV'.
14. By now you have probably seen the code execution pattern.

I have forked your program and edited the code so a class is not used (it's not needed) and a range of numbers is converted to Roman Numerals:

posted to Ask by bhavika29

Here is some examples. There are some reference links at the top of the code for you to follow up:

Parse Error: bad input (but I'm not sure what the issue is)
posted to Ask by MatthewRodrigu2

I get an error on line 606 when I run your program. It is because the code within the draw_hill function is not indented. You are also defining the draw_curve function within the draw_canyon one. This looks a bit suspect to me.

How to continue after initial input
posted to Ask by Forgotten_Prime

Basically most of your game logic needs to be inside the loop. For example the repetitive asking of the user whether they want to choose this tunnel or that one... You may also need further loops within your code depending on its logic.

when - print (colors) the output comes ['Green', 'Black', 'Blue']
posted to Ask by yamit1918

You can make your own function that prints a list as you see fit. The code below prints the items in a list separated by a comma and space:

def print_list(a_list):
  str = ''
  for item in a_list:
    str += item + ', '
  # Remove last comma and space from the end
  # of the string as it's not needed

colors = ["Green", "Red", "Blue"] # Do not modify this line
# Insert your code below this line
# Print "Green" by using it's index
print (colors[0] )
# Print "Blue" by using it's index
print (colors[2])
# Add "Black" to the second index
colors[1] = "Black"
# Print the updated colors list
print_list (colors)
# Append "Orange" to the colors list
# Print the updated colors list
How to display the fetched image array?
posted to Ask by PhilipChristian

Cool little program. You don't have to use jQuery these days. I forked your program and edited the code. See what you think:

JS Assignment 16: Using Callbacks in Array Methods
posted to Ask by maximussallam

Study these examples:
Note that the map example can be written:

var array1 = [1, 4, 9, 16];

// This function doubles the input value and returns it
function doubler(x) {
    return x * 2;
// pass the function to map
const map1 =;

// expected output: Array [2, 8, 18, 32]
Animating Circles and Squares
posted to Share by rjlevy

@rjlevy Great. Thanks for making the effort.

Animating Circles and Squares
posted to Share by rjlevy

Good work. Could you colorize the shapes?

What is wrong with my code?
posted to Ask by AbigailBurstein

It's always a good idea to read the error messages. One says that you are missing the while part of your do while loop. Actually, you don't need this type of loop as a simple while will do. Check this fork of your program out:

Also, you spelled salary wrong :-)

And... No need to send to output the returned result of calling the setup functions at the top of main e.g. setiosflags(ios_base::fixed);
Rather than...
cout << setiosflags(ios_base::fixed);
And so on...

How do I return the largest number in this given array?
posted to Ask by MaikaLangi

Your function is incorrect. Here is the correct code:

function getLargestNumber(numbers) {
  // Set biggest number to be the first one in the array
  let biggest = numbers[0];
  for (let i = 0; i < numbers.length; i++) {
    // If the current number is bigger than the biggest 
    // so far, set the biggest to the current number
    if (numbers[i] > biggest){
      biggest = numbers[i];
  // biggest must be the largest because the whole 
  // array has been traversed
  return biggest;

Now, how could you modify the program to find the smallest number?

where is wrong ?
posted to Ask by marcolettigames

The error is near the end of your code. This:
print(zdacaRus2 %(money-50)
Should be this:
print(zdacaRus2 %(money-50))
Spot the difference!

[PHP] How to redirect all outgoing requests to a different address
posted to Ask by GavHern

You sure can. On your out.php page you can get the parameter passed using this code:

// Get parameter value
$url = $_GET["url"];

// Do some basic error checking
if(!isset($url)) {

// Go to the url
header("Location: $url");
posted to Ask by troylow

This fork of your program will show how to use namespaces. Also there is a reference to explanations:

Inicializacion de aprendizaje de lenguaje de programación
posted to Ask by arielsolanoo

Veo que usas el idioma español. Debe decidir qué lenguaje de programación desea aprender, sugiero Python, ya que es relativamente simple, y luego encontrar tutoriales escritos en español. Tenga en cuenta que la mayoría de los lenguajes de programación usan la sintaxis en inglés.

Can't get random number generator to populate random number and push to array
posted to Ask by bobmcphe

Have a loop at this fork of your repl. I have put comments in your code where there are errors. Also I have fixed the indentation:

repl theme white to black?
posted to Ask by aislepot

There is a settings/config link in the menu at far left. Click on it to open the config options.

Repeating loop without explanation
posted to Ask by xolyon

The error is occurring in one of these lines of code: 225, 257, or 289. I suggest changing the text output (using the print function) immediately after the while loops to trace down which one it is.

Do you know how to write functions? Your code, though neatly laid out, uses nested while loops. This is not good as things can get complex quite quickly and the code is hard to debug. Splitting out the different parts of your program code into functions (some may have while loops) would be helpful. Done well the repeated parts of your code could be eliminated.

My repl is not displaying board which I want to. It just saying invalid syntax. What to do?
posted to Ask by Devanshu1234

You have two errors:
1) The display_board function needs to be called by placing empty parentheses after the function name, like so: display_board()
2) You are missing some + signs in your print calls. So instead of
print(board[0] + " 1 " board[1] + " 1 " + board[2]), use
print(board[0] + " 1 " + board[1] + " 1 " + board[2]) ,
and so on...

I'm not understanding the error.
posted to Ask by thouse91

The example code is looks like it is a mix of Java and JavaScript. They are two very different languages. Do some research. Also, find a basic Java tutorial and learn the basics. Here is a link to an example program that shows how to create and use a class: