BMI
The BMI is calculated with this formula:
$$\text{BMI} = \frac{m}{l^2}$$
with $m$ as the mass in kg and $l$ as the height in m.
Write code that shows "Underweight" for $\text{BMI} < 18.5$, "Normal weight" for $18.5 \le \text{BMI} < 25$ and "Overweight" for $25.0 \le \text{BMI}$.
Test your code with the two sliders below.
The variables m
and l
are already defined and their values are updated with the sliders.
m
= 2 (kg)
l
= 0.3 (m)
Number of grains
You know for sure about the story with grains for every chess square.
A chess board has 64 squares. For the first square, there is only one grain. For the second one, there are two grains. The number of grains doubles for every square.
Calculate the number of grains for every square and their sum.
Reverse string
Write a function named reverse_string
that takes an argument as a string and returns the reversed string.
No cheating by using builtin reversing functions!
Example: "string" would get "gnirts".
🔴 The function reverse_string
is not implemented yet 🤨
String extraction
Extract the string "Hello world" out of the string variable mess
defined below.
The space between the two words must be included!
The extracted string should be contained in a variable named extracted
.
Hint: Remember that strings are a chain of characters. So you can use a lot of what you have learned about vectors on strings.
"OHLENLNLMUIOQ WNHSIDWNOURLDSD"
🔴 The variable extracted
is not defined yet 🤨
Squaring difference
Write a function named squaring_difference
that takes one argument N
as a natural number and returns the following:
$$\left(\sum_{i=1}^N i\right)^2 - \sum_{i=1}^N i^2$$
🔴 The function squaring_difference
is not implemented yet 🤨
Tick-tack-toe
Only for those who have time left and want to try a hard task!
Now that you know about matrices in Julia, use a matrix to present a Tick-tack-toe board.
To place X
or O
, take the user input for the row and column using the the form below. The input is stored in the variables input_row
and input_column
. Click on "Submit Query" to submit the input.
Make sure you update the board after the user input.
You want more?
Implement player names.
Implement a check if a user did win.
Check your code for possible performance issues. Try to minimize allocations.
Implement a playing AI. No, kidding! Just tell me to give you more tasks if get here 😂
BTW: You can use Julia for AI, so the programming language is not the limitation here 😅
Row:
Column:
1