From 8463c5cd88e34cf0d086e97e30637f839eacdc12 Mon Sep 17 00:00:00 2001 From: Prefill add-on Date: Sun, 14 Jul 2024 16:21:10 +0200 Subject: [PATCH] Translated using Weblate (Croatian) Currently translated at 0.0% (0 of 189 strings) Co-authored-by: Prefill add-on Translate-URL: https://hosted.weblate.org/projects/hedy/commands/hr/ Translation: Hedy/Cheatsheets --- content/cheatsheets/hr.yaml | 208 +++++++++++++++++++++++++++++++++++- 1 file changed, 207 insertions(+), 1 deletion(-) diff --git a/content/cheatsheets/hr.yaml b/content/cheatsheets/hr.yaml index 0967ef424bc..e7232083702 100644 --- a/content/cheatsheets/hr.yaml +++ b/content/cheatsheets/hr.yaml @@ -1 +1,207 @@ -{} +1: +- demo_code: '{print} Hello welcome to Hedy!' + name: '{print}' + explanation: Print something with `{print}`. +- name: '{ask}' + demo_code: '{ask} What is your favorite color?' + explanation: Ask something with `{ask}`. +- demo_code: "{ask} What is your favorite color?\n{echo} so your favorite color is" + name: '{echo}' + explanation: Repeat something using `{echo}`. +- name: '{print} emojis' + demo_code: '{print} 🙋 🌍 ❗' + explanation: Print an emoji with `{print}`. +- demo_code: '{forward} 100' + explanation: Draw a line with `{forward}`. + name: '{forward}' +- demo_code: "{forward} 25\n{turn} {left}\n{forward} 25\n{turn} {right}" + explanation: Turn the drawing turtle with `{turn}`. + name: '{turn}' +2: +- name: '{is}' + demo_code: "name {is} Hedy\n{print} welcome name" + explanation: Give a word a name to use in the program using `{is}`. You can choose the name yourself. +- demo_code: "color {is} {ask} What is your favorite color?\n{print} color is your favorite!" + name: '{ask}' + explanation: Ask something with `{ask}`. Beware! You need to give the answer a name with `{is}`. +- demo_code: "{print} Let me think for one second...\n{sleep}\n{print} Hmm.. I need 3 more seconds...\n{sleep} 3\n{print} Eureka! Ive got it!" + explanation: With `{sleep}`, you can let Hedy pause for a (couple of) second(s). + name: '{sleep}' +- demo_code: "angle {is} 90\n{turn} angle\n{forward} 100" + explanation: Give a number a name using `{is}`. You can choose the name yourself. + name: '{is} with turtle' +3: +- name: Choose random + explanation: Choose a random word from a group with `{at}` and `{random}`. + demo_code: "animals {is} dog, cat, kangaroo\n{print} animals {at} {random}" +- demo_code: "animals {is} cow, cat\n{add} dog {to_list} animals" + explanation: '`{add}` an item `{to_list}` a list.' + name: '{add}' +- explanation: '`{remove}` an item `{from}` a list.' + demo_code: "animals {is} cat, dog, cow\n{remove} dog {from} animals" + name: '{remove}' +5: +- explanation: Print exactly using quotation marks. + name: '{print}' + demo_code: "{print} 'Hello welcome to Hedy.'" +- name: '{ask}' + demo_code: "color {is} {ask} 'What is your favorite color?'\n{print} color ' is your favorite!'" + explanation: Ask something with `{ask}`. +- demo_code: "color {is} {ask} 'What is your favorite color?'\n{if} color {is} green {print} 'pretty!' {else} {print} 'meh'" + explanation: Make a choice with `{if}`. + name: '{if}' +- name: '{if} with turtle' + explanation: Make a choice with `{if}`. + demo_code: "answer {is} {ask} 'How far should I walk?'\n{if} answer {is} far {forward} 100 {else} {forward} 5" +- demo_code: "pretty_colors {is} green, yellow\ncolor {is} {ask} 'What is your favorite color?'\n{if} color {in} pretty_colors {print} 'pretty!' {else} {print} 'meh'" + explanation: Check elements with `{in}`. + name: '{in}' +- demo_code: "{if} a {is} {pressed} {print} 'You pressed A!' {else} {print} 'You pressed another key!'" + explanation: Check whether a given key on the keyboard is `{pressed}`. + name: '{pressed}' +12: +- explanation: Decimal numbers. + demo_code: "{print} 'Calculate away!'\n{print} 'Two and a half plus two and a half is...'\n{print} 2.5 + 2.5" + name: float directly +- demo_code: "name = 'Hedy the Robot'\n{print} 'Hello ' name" + explanation: Text with quotation marks after `=` + name: assign text +- explanation: Text with quotation marks after `{if}`. + name: quotes after `{if}` comparison + demo_code: "name = {ask} 'Who are you?'\n{if} name = 'Hedy'\n {print} 'Hi there!'" +- demo_code: "superheroes = 'Iron Man', 'Batman', 'Superman'\n{print} superheroes {at} {random}" + explanation: A list with quotation marks. + name: quotes in list +9: +- demo_code: "answer = {ask} 'What is 10 plus 10?'\n{if} answer {is} 20\n {print} 'Well done!!'\n {print} 'The answer is indeed' answer\n{else}\n {print} 'Wrong'\n {print} 'The answer is 20'" + name: '{if} with multiple lines' + explanation: The answer of a sum of questions with `{ask}` and see if it is correct. Now we print out two lines. +- explanation: Repeat multiple lines. + name: '{repeat} with turtle' + demo_code: "{repeat} 4 {times}\n {turn} 90\n {forward} 50" +10: +- name: '{print}' + demo_code: "{print} '5 times 5 is ' 5 * 5" + explanation: Print something. Remember to use a quotation mark for literal printing. +- explanation: Print all things in a list. + name: '{for} with a list' + demo_code: "animals {is} dog, cat, blobfish\n{for} animal {in} animals\n {print} 'I love ' animal" +15: +- demo_code: "answer = 0\n{while} answer != 25\n answer = {ask} 'What is 5 times 5?'\n{print} 'A correct answer has been given'" + explanation: We can use the `{while}` loop with not equal. + name: '{while}' +- name: Smaller {while} + demo_code: "count = 1\n{while} count < 3\n {print} 'We do this ' 3 - count ' more times'\n count = count + 1\n{print} 'We are done'" + explanation: We can also use the `{while}` loop with `<` and `>`. +14: +- explanation: We use the `<` to check if the first number is smaller than the second number. + demo_code: "age = {ask} 'How old are you?'\n{if} age < 13\n {print} 'You are younger than me!'" + name: Smaller +- demo_code: "age = {ask} 'How old are you?'\n{if} age > 13\n {print} 'You are older than me!'" + name: Bigger + explanation: We use the `>` to check if the first number is bigger than the second number. +- demo_code: "answer = {ask} 'What is 5 * 5?'\n{if} answer == 25\n {print} 'That is correct!'" + name: Equal + explanation: We use the `==` to check if two things are the same. +- explanation: We use the `!=` to check if two things are not the same. + name: Not equal + demo_code: "answer = {ask} 'What is 5 * 5?'\n{if} answer != 25\n {print} 'That is not correct!'" +- demo_code: "age = {ask} 'How old are you?'\n{if} age <= 12\n {print} 'You are younger than me!'" + name: Smaller or equal + explanation: We use the `<=` to check if the first number is smaller than or equal to the second number. +- demo_code: "age = {ask} 'How old are you?'\n{if} age >= 14\n {print} 'You are older than me!'" + explanation: We use the `>=` to check if the first number is bigger than or equal to the second number. + name: Bigger or equal +17: +- explanation: '`{elif}`' + demo_code: "a = 2\n{if} a == 1:\n {print} 'a is 1'\n{elif} a == 2:\n {print} 'a is 2'\n{else}:\n {print} 'a is not 1 or 2'" + name: '{elif}' +- name: '{print}' + demo_code: "{for} i {in} {range} 1 {to} 12:\n {print} i\n{print} 'Ready or not, here I come!'" + explanation: When we use a `{for}`, we need to put a `:` behind the `{for}` statement! +- explanation: We need to do the same with all of our `{if}` statements. + name: '{if}' + demo_code: "color = {ask} 'What is your favorite color?'\n{if} color == 'green':\n {print} 'Your favorite color is green'\n{else}:\n {print} 'Your favorite color is not green'" +18: +- explanation: After `{print}` you need to use parentheses. + demo_code: "{print}('hi!')" + name: '{print}' +- name: '{range}' + explanation: After `{range}` you need to use parentheses. + demo_code: "{for} i {in} {range} (1,10):\n {print}('Hello, times ', i)" +- demo_code: "name = 'Hedy'\n{print}('my name is ', name)" + explanation: With `{print}` you need to use parentheses and commas if you print more items. + name: '{print} with var' +- demo_code: "name = {input}('What is your name?')\n{print}('So your name is ', name)" + explanation: Use `{input}` instead of `{ask}` to ask something. + name: ask something with {input} +13: +- explanation: Two parts both need to be correct. + demo_code: "answer1 = {ask} 'What is 3+2?'\nanswer2 = {ask} 'What is 2+2?'\n{if} answer1 {is} 5 {and} answer2 {is} 4\n {print} 'Both answers are correct!'\n{else}\n {print} 'At least one answer is wrong!'" + name: '{and}' +- demo_code: "answer1 = {ask} 'What is 3+2?'\nanswer2 = {ask} 'What is 2+2?'\n{if} answer1 {is} 5 {or} answer2 {is} 4\n {print} 'At least one answer is correct!'\n{else}\n {print} 'Both answers are wrong!'" + name: '{or}' + explanation: At least 1 of the two parts need to be correct. If both are correct, it is also fine. +4: +- explanation: Print exactly using quotation marks. + name: '{print}' + demo_code: "{print} 'Hello welcome to Hedy.'" +- demo_code: "name {is} Hedy\n{print} 'my name is ' name" + name: '{is}' + explanation: Give a name to some text and `{print}` without quotation marks. +- explanation: Ask something with `{ask}`. + demo_code: "color {is} {ask} 'What is your favorite color?'\n{print} color ' is your favorite!'" + name: '{ask}' +16: +- name: square brackets + explanation: Lists with square brackets. + demo_code: "fruit = ['apple', 'banana', 'cherry']\n{print} fruit" +- name: Get an item from a list + explanation: To get an item from a list we use [number] so fruit[1] means, get the first fruit from the list! + demo_code: "fruit = ['banana', 'apple', 'cherry']\nfirstfruit = fruit[1]\n{print} firstfruit" +- name: Get a random item from a list + explanation: To get a random item from a list we use [{random}] so fruit[{random}] means, get a random fruit from the list! + demo_code: "fruit = ['banana', 'apple', 'cherry']\nrandom_fruit = fruit[{random}]\n{print} random_fruit" +8: +- name: '{print}' + explanation: Print something. Remember to use a quotation mark for literal printing. + demo_code: "{print} '5 times 5 is ' 5 * 5" +- name: '{ask}' + demo_code: "answer = {ask} 'What is 5 plus 5?'\n{if} answer {is} 10\n {print} 'Well done!'\n {print} 'Indeed, the answer was ' answer\n{else}\n {print} 'Oops!'\n {print} 'The answer is 10'" + explanation: Ask for the answer to a sum and check if it is correct. We can now print 2 lines. +- explanation: Repeat multiple lines. + name: '{repeat} with turtle' + demo_code: "{repeat} 4 {times}\n {turn} 90\n {forward} 50" +- name: '{pressed}' + explanation: Check whether a given key on the keyboard is `{pressed}`. + demo_code: "{if} a {is} {pressed}\n {print} 'You pressed A!'\n{else}\n {print} 'You pressed another key!'" +6: +- demo_code: "{print} '5 times 5 is ' 5 * 5" + explanation: Print exactly using quotation marks. + name: '{print}' +- name: '{ask}' + demo_code: "answer = {ask} 'What is 10 plus 10?'\n{if} answer {is} 20 {print} 'Yes!' {else} {print} 'Oops'" + explanation: Ask for a calculation and check whether it is correct. +- name: '`{ask}` and `{if}` with turtle' + explanation: Ask the user how many angles they want. + demo_code: "angles = {ask} 'How many angles?'\nangle = 360 / angles\n{forward} 50" +7: +- explanation: Print exactly using quotation marks. + name: '{print}' + demo_code: "{print} 'Hello welcome to Hedy.'" +- name: '{ask}' + explanation: Ask something with `{ask}`. + demo_code: "color = {ask} 'What is your favorite color?'\n{print} color ' is your favorite!'" +- explanation: Make a choice with `{if}`. + name: '{if}' + demo_code: "color = {ask} 'What is your favorite color?'\n{if} color {is} green {print} 'pretty!' {else} {print} 'meh'" +- demo_code: '{repeat} 3 {times} {forward} 10' + explanation: Repeat a line of code with `{repeat}`. + name: '{repeat} with turtle' +11: +- demo_code: "{for} counter {in} {range} 1 {to} 5\n {print} counter" + explanation: We can use `{for}` with a `{range}`. + name: '{for} loop' +- name: '{ask}' + demo_code: "answer = {ask} 'What is 5 plus 5?'\n{if} answer {is} 10\n {print} 'Well done!'\n {print} 'Indeed, the answer was ' answer\n{else}\n {print} 'Oops!'\n {print} 'The answer is 10'" + explanation: Ask for the answer to a sum and check if it is correct. We can now print 2 lines.