Tutorial A4¶
1 Can you answer these questions?
What is a Python object?
How would you assign a value to a variable?
How can you know, something is an object in Python?
How can you know a Python object is a function?
How can you get an overview of all the attributes of an object?
How can you discover all objects currently available?
2 Call help()
on the built-in Python function help
to see what it does.
3 Which methods (disregarding double underscore methods __method__
) does a str
object have? Try out those of them that deal with case-formatting (upper/lower case letters) with an example of your choice and explain shortly what they do.
4 Which methods (disregarding double underscore methods __method__
) does a complex
object have? Try out all of them with an example of your choice and explain shortly what they do.
5 When you call print(string)
, the value of string
is printed to the screen. Call help()
on the built-in Python function print
to see what it does. Can you figure out just by reading the help message how to automatically print an exclamation mark (!
) after the print?