This script contains exercises to repeat topics learned during the "Introduction to programmin with Python" course.
The scripts from this course are avaible at https://siscourses.ethz.ch/python_dbiol
Write a program which asks the user for a number and checks if the number is positive, negative or zero and prints an appropriate message
Implement https://www.wikiwand.com/en/Fizz_buzz#/Play up to 50
.
Write a program which asks the user for a number n
and then computes the sum 1 + 2 + ... + n
.
Implement a number guessing game: the computer creates a random number in the range 1
to 100
and asks the user to guess until the user finds the number. If the number is not correct, the computer prints a message if the guess is to low or to high.
Redo the collatz iteration exercise 5.3 of script https://siscourses.ethz.ch/python_dbiol/04_looping.html
GC
content of a given sequence of symbols ATGC
.Write a function sum_up_to(n)
which takes an integer number n
and returns the sum 1 + 2 + ... n
.
Write a function collatz_count(n)
which counts the number of collatz iterations needed to reach 1
starting with n
(see also exercise 5.3 of script https://siscourses.ethz.ch/python_dbiol/04_looping.html)
Write a function collatz_values(n)
which returns a list of numbers of the collatz iterations starting with n
.
Write a function is_prime(n)
which returns True
if given n
is prime else False
.
Write a function filter_even(li)
which takes a list li
of integer numbers an returns a list containg the even numbers of li
.
Write a function revert(txt)
which reverts a given string txt
.
Write a function is_palindrome(txt)
which returns True
if txt
reads backwards as forwards, else False
.
x_values = [0, 0.1, 0.2, ... 6.2]
and y_values
with the $sin$ of the x_values
. Then use matplotlib
to plot this data.