
Session 2: Assignments
1. Read the given handout and answer the following questions:
- How to check a variable’s type?
- In what cases, you will get SyntaxError from the compiler telling you
that some of your variables have invalid names? Can you give 3
different examples of invalid names?
2. Write a program that calculates the area of a circle. The circle radius is
entered by users
Expected screen output:
# This one is a little bit better
3. Write a program that converts Celsius (0C) into Fahrenheit (0F)
Expected screen output:
# This one is a little bit better
4. Bacteria B replicates itself each 2 minutes, write a program that asks users
to enter two numbers: the initial B bacteria number and a period of time
(in minutes). Calculate and print out the total number of B bacteria after
this period.
B B
B B B B
B B B BBB B B
2 minutes
2 minutes