- Log into jupyter.math.bme.hu with your leibniz user and password
- We will use Python 3
- this is similar as you would run the following on your own machine
- type this into your konsole:
- you can stop by typing:
Install Anaconda, version 3.7 is needed!
Having Anaconda you can run several programs to interact with python:
- command line: python or ipython
- jupyter notebook
- Try the notebook from the lecture.
- download from wiki and upload it into jupyter.math.bme.hu
- Try a welcoming program (from terminal)!
- Try division (integer and float)
Write a python program that convets from Fahrenheit to Celsius
- See examples here
Write a function that tells whether a number is a prime or not!
The function should be called isaprime and have one parameter:
- x, the number in question
The function should return
depending on the number.
For safety reasons, you can check the type and value of the input. Accept only positive integers!
If you get a non-integer or a non-positive integer, return
According to Wikipedia a room has a temperature between 18°C and 25°C. Write a function that decides that for us.
The function should
- be called roomtemp
- have one parameter: degree the temperature of the room in Celsius degrees.
- return either one of the following strings depending on the temperature:
Mind that there is a difference between
Write a python program which calculates n factorial.
You should divide a positive integer n with a power of two, until it is not divisible by 2.
Call the function
withouttwo with one parameter:
- n, a positive integer
- Return the number divided by the greatest possible power of two.
1 -> 1 2 -> 1 3 -> 3 4 -> 1 6 -> 3 7 -> 7 9 -> 9 10 -> 5 100 -> 25
Write a python program which has the following output:
1 22 333 4444 55555 666666 7777777 88888888 999999999
Write a Python program to get the Fibonacci series between 0 to 50.