Lia was picking flowers. On the first day, she picked 15 flowers. On the second day, she picked 4 more flowers than on the previous day, and on the third day, she picked 1 more flower than on both previous days together. Use Python as a calculator and calculate how many flowers she picked in total over all 3 days.
Johnny bought a game for 79 euros. Later, he bought another game for double that price plus an additional 5 euros. Finally, he bought a game for triple the price of the second game plus an additional 17 euros. Use Python as a calculator and calculate:
Use Python as a calculator and calculate the sum of the following numbers: one, one half, one third, one quarter, … , up to one tenth.
Create commands corresponding to the following instructions:
For example, for x equal to 5, you should get the result 54.
We denote the area of a circle by S and calculate it using the formula πr². We denote the circumference of a circle by O and calculate it using the formula 2πr. Try to name the variables for the radius, area, and circumference of the circle using suitable longer names and assign the correct expressions to them. Also create a variable pi with the value 3.14.
Which of the following names cannot be used as variable names?
kuk
Ahoj!
1.A
prva_trieda
cierno-biele
OK
o0o0o0o
asdf
vek
počet osôb
trieda(3)
Print “Hello World” on the screen.
Find out what Python prints when using the following commands:
print(1 + 2 * 3)
print('1 + 2 * 3')
print()
The print command can print multiple things – try the following commands. What does the comma do in each command?
print('I like', 'cabbage')
print('My favorite number is', 42)
print('I went to school for', 2 * 10, 'minutes')
Use the print command to display your height in inches. One inch is approximately 2.5 cm.
Explore what happens when you forget to write something in the following commands:
print('Hello) ... the apostrophe?
print(Hello) ... both apostrophes?
print 'Hello' ... the parentheses?
print('Hello' 10) ... the comma?
Formatted output – f-strings – https://www.w3schools.com/python/python_string_formatting.asp Create formatted output for the sentence: The price of a new computer is … euros. Instead of …, insert a variable containing the stored price. Modify the previous program so that it displays the price after a 20% discount and rounds the result to two decimal places.