Lecture 3 - Programming 2 - 2024-2035 PDF
Document Details
Uploaded by WellMadeAmber2007
Al Janad University for Science and Technology
Dr. Bilal Al-samaee
Tags
Summary
This is a lecture on Programming 2. The lecture covers topics in Python programming, including data types, conversions, operators (arithmetic, comparison, assignment, logical, bitwise, and boolean), decision making, and loops.
Full Transcript
جامعة الجند كلية الهندسة وتقنيات المعلومات قسم الذكاء االصطناعي وعلم البيانات – مستوى اول المحاضرة 3 د.بالل السامعي 2024-2035 Dr. Bilal Al-samaee 1 Contents Data Type Conversi...
جامعة الجند كلية الهندسة وتقنيات المعلومات قسم الذكاء االصطناعي وعلم البيانات – مستوى اول المحاضرة 3 د.بالل السامعي 2024-2035 Dr. Bilal Al-samaee 1 Contents Data Type Conversion Types of Operators Arithmetic Operators Comparison Operators Assignment Operators Logical Operators Identity Operators Bitwise Operators Booleans operators Decision Making Loops Dr. Bilal Al-samaee 2 Data Type Conversion a = int(2.2) b = float(34) c = str(2.2) Sometimes, you may need to perform conversions print(a,b,c) between the built-in data types. To convert data print(type(c)) between different Python data types, you simply use s=[1,2,3,5,6,'gg'] the type name as a function. f1=tuple(s) b = int(2.2) f2=list(s) f3=set(s) a = float(1) print(type(f1)) b = str(2.2) print(type(f2)) print(type(f3)) tuple(s) list(s) 2 34.0 2.2 set(s)