Python Essentials 1 by The OpenEDG Python Institute

by The OpenEDG Python Institute · Views: 150 · Format: EPUB · Language: English (en)

Cover of Python Essentials 1 by The OpenEDG Python Institute — Free EPUB on AnyEbooksEPUB

for these operations. If op is a two-argument operator (this is a very important condition) and the operator is used in the following context...: variable = variable op expression ...then it can be simplified and shown as follows: variable op= expression Take a look at the following examples. Make sure you understand them all. Expression Shortcut operator i = i + 2 * j i += 2 * j var = var / 2 var /= 2 rem = rem % 10 rem %= 10 j = j – (i + var + rem) j -= (i + var + rem) x = x ** 2 x **= 2 LAB 6 Variables ‒ a simple converter Miles and kilometers are units of length or distance. Bearing in mind that 1 mile is equal to approximately 1.61 kilometers, complete the program so that it converts: miles to kilometers; kilometers to miles. Do not change anything in the existing code. Write your code in the places indicated by ### . Test your program with the data we've provided in the source code. Pay particular attention to what is going on inside the print() function. Analyze how we provide multiple arguments to the function, and how we output the expected data. Note that some of the arguments inside the print() function are strings (e.g. "miles is" , whereas some other are variables (e.g. miles ). TIP There's one more interesting thing happening there. Can you see another function inside the print() function? It's the round() function. Its job is to round the outputted result to the number of decimal places specified in the parentheses, and return a float (inside the round() functi

★★★★★

Rate this eBook

File Name:67239ef137e7752046e7e253aad69595.epub
Original Title:Python Essentials 1
Creator / Author:The OpenEDG Python Institute
Language:English (en)
Identifier:ASIN:306681
Publisher:The OpenEDG Python Institute Publishing
Category:Fiction
Format:📗 EPUB eBook
File Size:3.5 MB

Community Reviews

Loading verified community reviews...

Related Fiction Titles