Exercise 1 - (function + conditions)
Define a maximum function (n1,n2,n3) that returns the largest of 3 numbers n1, n2, n3 provided in arguments. For example, executing the instruction :
print (maximum(2,5,4)) #must give the result : 5
Exercise 2 - (loop)
Write a program that displays the first 20 terms of the 7-fold multiplication table
Exercise 3 - ( loop + arithmetic operations)
Write a program that displays a conversion table of sums of money expressed in euros, in American dollars. The progression of the table sums will be "geometric", as in the example below:
1 euro(s) = 0,86
2 euro(s) = 1,72 dollar(s)
4 euro(s) = 3,44 dollar(s)
8 euro(s) = 6,88 dollar(s)
etc. (stop at 14.090,24 dollars)
Exercise 4 - ( loop + condition)
Write a program that displays the first 20 terms in the 7-fold multiplication table, marking (with an asterisk) those that are multiples of 3 (see the operator modulo %).
Exercise 5 - ( loop + string)
Write a program that displays the following sequence of symbols:
Exercise 6 -
( loop +
Write a program that calculates the interest accumulated each year for 20 years, by capitalizing a sum of 100 euros placed in the bank at a fixed rate of 4.3%.
Exercise 7 - ( loop + string + condition)
Write a script that determines whether a string contains the character "e" or not
note : Use the function « len(s) » which return the length of a given string. Ie.
size = len(« Hello »)
print (size) # it displays 5
Useful for doing a loop to get each letter of s, using indexes from 0 to len(s) ...
- ( loop +
string + condition)
Write a script that takes a string provided by the user, and which insert asterisks between the characters (into a new string),
ie. "hello" becomes "h*e*l*l*o"