Tag Archives | tips and tricks

python-logo

Python Q&A – Class Design

Question 1: Using Classes A class is a user-defined prototype for an object that defines a set of attributes that characterize any object in the class. Task: write a function print_friend_info(person) which accepts a single argument, of type Person, and: prints out their name prints out their age if the person has any friends, prints […]

Continue Reading 0
python-logo

Python Q&A – Classes and Objects

Question 1: Using Range Python has a built in function range, which returns an iterable sequence of numbers. Task: Write a function sum_range(start, end) which uses range to return the sum of the numbers from start up to, but not including, end. (Including start but excluding end is the default behaviour of range.) Write a […]

Continue Reading 0

Powered by WordPress. Designed by WooThemes

Free WordPress Themes