EPUBSample Usage Explanation + Addition x + y Computes the arithmetic sum of the given operands. - Subtraction x - y Computes the arithmetic difference of the given operands. * Multiplication x * y Multiplies operands and returns the product. / Division x / y Performs division and returns the quotient. % Modulus x % y Performs division and returns the remainder. // Floor Division x // y Performs division first and returns the floor value of the quotient. The floor function in mathematics gives the closest integer which is less than the given value. For example, floor(2.45) = 2 and floor(-4.67) = -5. ** Exponent x ** y Raises the power of the operand on the left by a value of the operand on the right. For example, 2 ** 3 will return 8. Let us write a simple python script that demonstrate the usage of arithmetic operators on two operands. The operands are assigned arbitrary values. #Arithmetic operators demo #Declare two variables, assign arbitrary values x = 53 y = 24 #Perform Arithmetic operations, assign result to variables #Calculate sum sum = x + y #Calculate difference difference = x - y #Calculate product product = x * y #Perform division quotient = x / y #Modulus mod = x % y #Perform floor division floor_quotient = x // y #Exponent exp = x ^ y #Display everything print ( "nx = " , x , "y = " , y , "nsum = " , sum , "ndifference = " , difference , "nproduct = " , product , "nquotient = " , quotient , "nremainder = " , mod , "nquotient (floor value) = " , floor_quotien
Rate this eBook
| File Name: | c000bbd5173887a4580acdad469a0674.epub |
| Original Title: | Python GUI Programming with PyQt |
| Creator / Author: | Metzler, Nathan |
| Language: | English (en) |
| Identifier: | ASIN:313997 |
| Publisher: | Metzler, Nathan Publishing |
| Category: | Computer Science & Programming |
| Format: | 📗 EPUB eBook |
| File Size: | 3.5 MB |
-2.jpeg)

-12.jpeg)

-1.jpeg)