Lecture02-syntax-3pp

# Staticmethod str sum super tuple type vars zip

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4 003 001 Width 001 002 8 006 99 005 22 FuncAons Functions perform some computation. They can take some input (their arguments/parameters), and they can return some value Built-in vs. user-defined functions #!/usr/local/bin/python3 # Converts temperatures from Fahrenheit to Celsius # Ask user for input F = float( input("Please enter a temperature in Fahrenheit: ") ) # Do the conversion C = (F-32)*5/9; # Print the result print("The temperature in Celsius is: ", C ) 23 All of Python’s Built ­in FuncAons abs all any ascii bin bool bytearray bytes callable chr classmethod compile complex copyright credits delattr dict dir divmod enumerate eval exec exit 6ilter 6loat format frozenset getattr globals hasattr hash help hex id input int isinstance issubclass iter len license list locals map max memoryview min next object oct open ord pow print property quit range repr reversed round set setattr slice sorted staticmethod str sum super tuple type vars zip 24 8 13 ­09 ­10 Operators Operators correspond to special symbols. They do some computation on their operands. #!/usr/local/bin/python3 # Converts temperatures from Fahrenheit to Celsius # Ask user for input F = float( input("Please enter a temperature in Fahrenheit: ") ) # Do the conversion C = (F-32)*5/9 # Print the result print("The temperature in Celsius is: ", C ) Operators are like functions, just they use a special syntax so that we can write code that is easier to read.. 25 Numeric Operators in Python 22 • Python provides a rich set of operators 1 Operation Addition Operato...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online