0% found this document useful (0 votes)
58 views4 pages

Python Data Types and Expressions Guide

The document contains examples of Python expressions involving data types, operators, and mathematical expressions. It tests expressions in the Python shell and evaluates whether variable names are correctly or incorrectly formatted. It also initializes variables in the Python shell with different data types like integer, real, logical, and string as requested.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views4 pages

Python Data Types and Expressions Guide

The document contains examples of Python expressions involving data types, operators, and mathematical expressions. It tests expressions in the Python shell and evaluates whether variable names are correctly or incorrectly formatted. It also initializes variables in the Python shell with different data types like integer, real, logical, and string as requested.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Mariana Mendez Escalante

A01254973
22 de septiembre del 2023

Activity 2. Data types, hierarchy of operators and


mathematical expressions.
a) Convert the following expressions in Python and test them in the shell.
 5 * 6 * (160 div 2 ** 3) mod 5 * 15 – 10
30 * (160 div 8) mod 75 – 10
30 * (20) mod 75 – 10
600 mod 75 – 10
0 – 10
-10

 ((1580 mod 6 * 2 ** 7)> (7 + 8 * 3 ** 4 )) AND ((15 * 2) == (60 * 2/4))


((2 * 128) > (7 + 8 * 81)) AND ((30) == (30))
((2 * 128) > (7 + 8 * 81)) AND ((30) == (30))
((256) > (7 + 648)) AND ((30) == (30))
((256) > (655)) AND ((30) == (30))
FALSE and TRUE
FALSE

 (15> = 3 ** 3) OR NOT (43 - 8 * 2 div 4 <> 3 * 3 div 3)


(15> = 27) OR NOT (43 – 16 div 4 <> 9 div 3)
(15> = 27) OR NOT (43 – 4 <> 3)
(15> = 27) OR NOT (39 <> 3)
FALSE or not TRUE
FALSE
Mariana Mendez Escalante
A01254973
22 de septiembre del 2023

 (120 >= 7 * 3 ** 2 AND 8> 3 or 15> 6) AND NOT (7 * 3 <5 + 12 * 2 div 3 **


2)
(120 >= 7 * 9 AND 8> 3 or 15> 6) AND NOT (7 * 3 <5 + 12 * 2 div 9)
(120 >= 63 AND 8 > 3 or 15 > 6) AND NOT (21 <5 + 24 div 9)
(120 >= 63 AND 8 > 3 or 15 > 6) AND NOT (21 <5 + 2)
(120 >= 63 AND 8 > 3 or 15 > 6) AND NOT (21 < 7)
TRUE and TRUE or TRUE and not FALSE
TRUE

 NOT (S> 3 AND S <= 10) OR (T> = 100 AND T <200), S = 5 and T = 70.
NOT (5 > 3 AND 5 <= 10) OR (70 > = 100 AND 70 < 200), S = 5 and T =
70.
NOT (TRUE and TRUE) OR (FALSE and TRUE)
NOT (TRUE) OR (FALSE)
FALSE

Senala si el nombre de las siguientes Correcto/incorrecto


de las variables es
_num_Nomina correcto
#interior Incorrecto
4Telefono Incorrecto
Diametro Correcto
Dirección_fija Correcto
miVariable Correcto
radio Correcto
Mariana Mendez Escalante
A01254973
22 de septiembre del 2023

TeléfonoCelular2 Correcto
Nombre apellido Incorrecto
rfc correcto

Add the screen print with the results obtained from the following exercise:
 Open the Python shell and initialize 5 variables with different data types (integer,
real, logical, string.
INTEGER

REAL

LOGIC

STRING
Mariana Mendez Escalante
A01254973
22 de septiembre del 2023

INCISO D

You might also like