+ 2

Can someone help me

I don't know what are explict and implict data types

4th Nov 2024, 12:25 PM
Szymon Grużewski
2 ответов
+ 3
Explicit means to manually tell the compiler to change the data type of the variable Implicit means to automatically change the data type of the variable by the compiler Below is the detailed info along with examples and some difference between them. https://www.geeksforgeeks.org/type-casting-in-JUMP_LINK__&&__python__&&__JUMP_LINK/
4th Nov 2024, 12:45 PM
Aysha
Aysha - avatar
+ 2
Szymon Grużewski , >> the data types itself are not implicit or explicit, but the behavior depends on the operation that will be applied. > explicitely typecasting: num_1 = int(input('enter a year number: ')) => result is int. to check if a year is a leapyear or not, we need to get an integer number. in this case the input number (string by default) will be converted expicitely to an int by using the int() function. > implicitely typecasting: int_1 = 42 int_2 = 3 res = int_1 / int_2 => result is float the division of 2 integer numbers are implicitely converted to float. using an addition, subtraction or multiplication of the both numbers will result in an integer. so no conversion is applied. >> the samples are meant for python, and can follow different rules in other programming languages.
4th Nov 2024, 7:15 PM
Lothar
Lothar - avatar