| الانجليزية | العربية | |
ask
|
⟷ |
اسأل
|
color
|
⟷ |
لون
|
forward
|
⟷ |
تقدم
|
play
|
⟷ |
اعزف
|
print
|
⟷ |
قول
|
turn
|
⟷ |
استدر
|
is
|
⟷ |
هو
|
sleep
|
⟷ |
انتظر
|
add
to
|
⟷ |
اضف
الى
|
at
random
|
⟷ |
بشكل
عشوائي
|
remove
from
|
⟷ |
ازل
من
|
clear
|
⟷ |
مسح
|
else
|
⟷ |
وإلا
|
if
|
⟷ |
اذا
|
in
|
⟷ |
في
|
not in
|
⟷ |
ليس_في
|
pressed
|
⟷ |
مضغوط
|
elif
|
⟷ |
وإلا اذا
|
repeat
times
|
⟷ |
كرر
مرة
|
and
|
⟷ |
و
|
or
|
⟷ |
أو
|
Great job! You've reached another new level! In the previous level you've learned to use multiple lines of code in an اذا or كرر command.
But you can't yet combine the two...
Good news! In this level you will be allowed to put an اذا inside an اذا, كرر inside a كرر command and in each other.
Give it a try!
كرر 3 مرة
order = اسأل 'What would you like to order?'
اذا order هو pizza
قول 'Yammie'
وإلا
قول 'pizza is better!'
In this level you can also put an اذا command inside another اذا command.
continue = اسأل 'Do you want to continue?'
اذا continue = yes
sure = اسأل 'Are you sure?'
اذا sure هو yes
قول 'We will continue'
وإلا
قول 'You are not sure'
وإلا
قول 'You do not want to continue'
We are now going to learn و and أو! If you want to check two statements, you don't have to use two اذاs but you can use و and أو.
If you use و, then both statements, left and right of the و need to be true. We can also use أو. Then only one statement needs to be correct.
name = اسأل 'what is your name?'
age = اسأل 'what is your age?'
اذا name هو 'Hedy' و age هو 2
قول 'You are the real Hedy!'
وإلا اذا name هو 'Hedy' أو age هو 2
قول 'So close.. but you are not Hedy!'
وإلا
قول 'You are not Hedy!'
With the و command you can shorten your rock, paper, scissors code! Check out the example code.
Finish the code such that a winner is always decided on. Run your code a few times to verify there is always a winner printed.
options = 'rock', 'paper', 'scissors'
your_choice = اسأل 'What do you choose?'
computer_choice = options بشكل عشوائي
قول 'You choose ' your_choice
قول 'The computer chooses ' computer_choice
اذا computer_choice هو your_choice
قول 'Tie'
وإلا اذا computer_choice هو 'rock' و your_choice هو 'paper'
قول 'You win!'
وإلا اذا computer_choice هو 'rock' و your_choice هو 'scissors'
قول 'The computer wins!'
_
In this level you can use اذا and كرر commands inside other اذا and كرر commands.
This gives you many options and really helps you to make your story interactive.
Finish the code so the اذا works correctly.
Add an اذا and وإلا for the part of the story where Robin goes home too.
Go back to your level 8 story and use at least two اذاs inside another اذا.
قول 'Robin is walking downtown'
location = اسأل 'Is Robin going into a shop, or does she go home?'
اذا location هو shop
قول 'She enters the shop.'
قول 'Robin sees an interesting looking book'
book = اسأل 'Does Robin buy the book?'
اذا book هو yes
_ قول 'Robin buys the book and goes home'
_ وإلا
_ قول 'Robin leaves the shop and goes home'
وإلا
قول 'Robin goes home'
By using the و and أو commands, you can make your stories more versatile. You can ask two questions and respond to the combination of answers.
Look at the example code and finish it. Then add at least 2 more اذا codes with و or أو.
Find a story from a previous level, and add one و or أو.
example_code: |
قول 'Our hero is walking through the forest'
قول 'The path splits two ways'
path = اسأل 'Which path should she choose?'
weapon = اسأل 'What weapon does she draw?'
اذا path هو 'left' و weapon هو 'sword'
_
لقد تعلمت صنع آلة حاسبة في المستويات السابقة. يمكنك الآن أن تطور البرنامج وتحوله للعبة حسابية. هكذا ...
score = 0
كرر 10 مرة
numbers = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
number_1 = numbers بشكل عشوائي
number_2 = numbers بشكل عشوائي
correct_answer = number_1 * number_2
قول 'What is ' number_1 ' times ' number_2 '?'
answer = اسأل 'Type your answer here...'
قول 'Your answer is ' answer
اذا _ هو _
score = score + 1
قول 'Great job! Your score is... ' score ' out of 10!'
Let's make the practice program a bit harder. The player now has to answers two questions correctly. Fill out the blanks to complete the program.
Sometimes, calculations have multiple correct answers. For example, 10 can be divided by 5 and by 2. So the question 'What number divides 10?' can be answered by 2 and by 5.
Ask for a calculation that has multiple correct answers, ask the player to answer it, and determine if it is correct using أو.
Empty the programming field and create your own solution.
answer1 = اسأل 'What is 10 times 7?'
answer2 = اسأل 'What is 6 times 7?'
اذا _ _ _ _ _ _ _
قول _
From this level on you can - among other things - use a كرر command inside a كرر command.
That makes songs like 'Happy birthday' even shorter!
Finish the song!
first_time = yes
كرر 2 مرة
كرر 2 مرة
اعزف C
اعزف D
اعزف C
اذا first_time هو yes
اعزف F
اعزف E
first_time هو no
وإلا
_
We can simplify the superspy code with و, such that we only need one اذا.
Complete the code by filling the right command on the blank. Tip: The superspy has to answer BOTH questions correctly, before they get the confidential information!
We want to confuse the enemy even more! Create a list with fake answers and select one at random when a wrong answer is given.
name = اسأل 'What is your name?'
password = اسأل 'What is your password?'
اذا name هو 'Agent007' _ password هو 'TOPSECRET'
قول 'Go to the airport at 02.00'
وإلا
قول 'Go to the train station at 10.00'
In this level you can use nesting to make your restaurant more realistic and more fun!
The indentation was removed in the example code. Can you figure out how much indentation each line needs in order for the code to work properly? If the customer orders pizza, Hedy shouldn't ask what sauce the customer wants.
Extra A restaurant does not stock all sauces. Make a list of available sauces and give a reply with each order whether you sell it.
Extra Pizzas have toppings. Ask customers what they want.
Extra Do customers want a drink? Ask them too!
قول 'Welcome to Restaurant Chez Hedy!'
people = اسأل 'How many people will be joining us today?'
قول 'Great!'
price = 0
كرر people مرة
_ food = اسأل 'What would you like to order?'
_ قول food
_ اذا food هو fries
_ price = price + 3
_ sauce = اسأل 'What kind of sauce would you like with your fries?'
_ اذا sauce هو no
_ قول 'no sauce'
_ وإلا
_ price = price + 1
_ قول 'with ' sauce
_ اذا food هو pizza
_ price = price + 4
قول 'That will be ' price ' dollar'
قول 'Enjoy your meal!'
In this level you will learn new commands to extend your code even further.
Place a و and a أو in the logical place in the program.
Expand your restaurant with at least one more و and one أو.
For example, create a special discount coupon that only applies to pizza, or give your customer a free drink
with fries and pancakes. Or something completely different of course!
price = 10
food = اسأل 'What would you like to eat?'
drinks = اسأل 'What would you like to drink?'
اذا food هو 'sandwich' _ drinks هو 'juice'
قول 'That is our discount menu'
price = price - 3
اذا drinks هو 'water' _ drinks هو 'juice'
قول 'That is a healthy choice'
قول 'That will be ' price ' dollars'
In this level you can use nesting, which allows you to make the haunted house even more interactive!
Now it's very hard to win this game, can you make it easier to win?
Change your code so it only has one wrong door and two correct doors instead of one correct door and two wrong ones?
Tip: This means changing the variable correct_door into wrong_door, and switching the اذا and وإلا code.
And of course you may also change the story and make it your own. Change the monsters or make it a happy game show where you get a gift!
قول 'Escape from the Haunted House!'
player = alive
doors = 1, 2, 3
monsters = zombie, vampire, giant spider
كرر 3 مرة
اذا player هو alive
correct_door هو doors بشكل عشوائي
قول 'There are 3 doors in front of you...'
chosen_door = اسأل 'Which door do you choose?'
اذا chosen_door هو correct_door
قول 'No monsters here!'
وإلا
قول 'You are eaten by a ' monsters بشكل عشوائي
player = dead
وإلا
قول 'GAME OVER'
اذا player هو alive
قول 'Great! You survived!'
Now that you know how to combine statements, you can create a touch type tool with مضغوط.
Finish the code. Each time a random letter should be chosen, which you have to press. You get a point for a correct press, and two points deduction for a wrong press. Extra Clear the screen after each letter, and show the user how many points they have scored.
points = 0
letters = a, b, c, d, e
كرر 10 مرة
letter = _ _ _
قول 'Press the letter ' letter
اذا letter هو مضغوط
_
_
_
Now that we can use a كرر inside a كرر, we can create more complex figures.
This code creates three black triangles, change that into five pink squares.
Extra Create a figure of your own choosing consisting of at least two different shapes types.
لون اسود
كرر 3 مرة
كرر 3 مرة
تقدم 10
استدر 120
لون ابيض
تقدم 50
لون اسود
Recreate the drawings with the turtle!
Extra The number in brackets indicates in how many lines of code this figure can be drawn. Can you do it in the same amount of lines?
Extra Give the player a choice which country they would like to see the flag of.
Hint for the nested squares:
colors = red, blue, orange, yellow, pink, purple, green, brown, black
distance = 120
كرر 5 مرة
_
Hint for the flags:
country = اسأل 'which country would you like to see the flag of?'
اذا country هو 'the Netherlands'
color_1 = red
color_2 = white
color_3 = blue
Debug this code. Good luck!
Warning! This code needs to be debugged!
قول 'Welcome to our sandwich shop'
amount 'How many sandwiches would you like to buy?'
كرر amount مرة
اسأل هو اسأل 'What kind of bread would you like your sandwich to be?'
types_of_bread هو white, wheat, rye, garlic, gluten free
اذا chosen_bread in types_of_bread
قول 'Lovely!'
وإلا
'I'm sorry we don't sell that'
topping هو اسأل 'What kind of topping would you like?'
sauce هو اسأل 'What kind of sauce would you like?'
قول One chosen_bread with topping and sauce.
price = amount * 6
قول 'That will be 'price dollars' please'
The staff at our emergency room has a problem. They say that there are a lot of patients coming in who don't really have an emergency and who should actually go to their gp. These people are filling up the waiting room and putting a lot of workload on our staff. Will you help the emergency room staff by making a triage app that tells the patient if they have to go to the emergency room or not?
Your program should tell the patient if they should 'go to the emergency room a.s.a.p.', 'call your healthcare provider to discuss your situation' or 'go to your own gp at earliest convenience'. The programm will ask these questions:
An error occurred.
An error occurred.
Success
Header
في انتظار ضغطة من لوحة المفاتيح...
نائم...
يجب أن تعمل تسجيل دخول كي تُسَلِّمَ واجبك.