SHOW:
|
|
- or go back to the newest paste.
1 | # IDLE | |
2 | ||
3 | # Exercise 1 | |
4 | # Create variables which will store data like your name (text), age (number), favourite meal (text) or favourite meal (text). | |
5 | # Display the text using the print() function. Use the created variables | |
6 | # Example: | |
7 | # My name is Adam, I’m 15 years old, my favourite meal is pizza and my favourite game is Minecraft. | |
8 | # Remember to convert the number to text (use str()). Use the + symbol to connect text to variables. | |
9 | ||
10 | ||
11 | # Exercise 2 | |
12 | # Write a script which will let the user enter grades from three subjects and display their average. | |
13 | # To get data from the user, use the input() function. | |
14 | # Remember that this function gets data as text and we need numbers to count the average | |
15 | # Our grade should be 5 and not "5" because 5+5=10, and "5"+"5"="55". Use int() function. | |
16 | # for example. int(input("enter your English grade: ")) | |
17 | # You can count an average by adding all the grades together and dividing the sum by their amount (the symbol of division is /). | |
18 | ||
19 | ||
20 | # Exercise 3 | |
21 | # Translator - create a program which will translate 5 different words in your language to English. | |
22 | # The user enters the words in their language and gets an answer: | |
23 | ||
24 | # >> Enter a word to translate: przycisk | |
25 | # Przycisk in English: button | |
26 | ||
27 | # For unknown words the following message should appear: | |
28 | # “Unfortunately, we do not have translation data for this word in our database yet.” | |
29 | # Use the if elif else conditional statements. | |
30 | # Use a while True loop so the program repeats itself all the time. | |
31 | # Remember about indentation (tab button). | |
32 | ||
33 | ||
34 | # Exercise 4 | |
35 | # Create a loop which will display numbers from -10 to 100. | |
36 | # Use the range() function. | |
37 | ||
38 | ||
39 | # Exercise 5* | |
40 | # Create an array named numbersArray and save 5 numbers in it. | |
41 | # Using a loop, get each element of the table and display the squared value of it. | |
42 | # Example: | |
43 | # For the number 2 the following should be displayed: 2 squared is 4 | |
44 | # For the number 5: 5 squared is 25 | |
45 | # Use the len() function which returns the length of the array. | |
46 | # Use a for loop to get all the elements from the array. |