Python Programming Tasks
Python Programming Tasks
Task 1: Operations
In this task, the user will introduce a desired operation and two numbers of interest. The numbers
will be saved in the variables “a” and “b”, and the operation will be saved under “operation”.
Possible operations: addition (+), subtraction (-), division (/), power (**). The program will resolve
the corresponding operation depending on the result given by the user.
**Note: If the user does not introduce one of the specified operations, print an error
message.
**HINT: Which function do you have to use in order to save the desired operation given by
the user in the variable “operation”, input or raw_input?
Task 2: Conversion
In this task, the program will convert a temperature given by the user from Celsius to Fahrenheit or
vice versa. For this aim, the user will be asked for the desired option, which is going to be saved in
the variable “option” (For this, you have to use the function raw_input, not input).:
Applied thermodynamics: Thermodynamical Properties for Industrial Applications. WS 18/19
Task 3: Lists
In this task, you have to create a list under the name “my_apartment” and save things you have in
your apartment, as many as you want. Print the list and say at the end how many things are in your
apartment.
**HINT: Which loop do you need to use in order to print the variables of the list? Can you
use the len function to count the variables? How?
In this file, a series of numbers in which 2*n is the step size will be saved. n is a number introduced
by the user. For instance, if n=3, the series would be: 6, 12, 18, 24,... You have also to ask the user for
the maximum amount of numbers that are going to be printed.
**HINT: In order to interact with the file, use the functions write and read from python. Use
a while loop to read the file and print the written lines in the file.