TP 3
TP 3
But:
The goal of this work is to improve in using various operators (assignment, arithmetic,
alphanumeric, and comparison) in Python syntax. Additionally, it aims to a deeper
understanding of the Python environment, including interactive mode and programming.
Practice one:
First part: Try to manually evaluate the instructions provided in the table below.
Instructions Expected result Type of data
a=16-7 a =……………. type(a)=…………….
b=a**2 b =…………… type (b)=……………
a=b%3
c=125 c =…………….. type(c)=…………….
c=c+3 b =……………. type (b)=……………
b=c//2
a=20 d =…………….. type(d) =…………….
b=42 f =……………... type (f) =……………
c=15 g =…………….. type(g) =…………….
d= (b-c) * a
f=a + b**2
g=d/f
a = ”evening” c =…………….. type(d) =…………….
b =5 d =……………. type (c) =……………
c = a+ str(b)
d=a*b
1
Second part: try executing the instructions in Python using interactive mode.
Practice two:
Write a program that assigns your name to the variable "name_user" and your birth year to the
variable "year_birth". The program should then calculate your age and display a message in the
following format: "YourName is X years old."