Message from Python discussions

November 2018

— None is None is True


>>> def get_id(id):
... if id < 10:
... return id
... else:
... return None
>>> get_id(5)
>>> get_id(20)
>>> if get_id(20) is None:
... print("None")

— So i should return data = None?

— Help me.

Given an integer N and letter C. Print the string of length N containing only C's.


— You can just assign your function to a variable name

— Read the rules

— And use it in your if statement

— It will then use the out put of the first return executed in your function

— This is my code.. data = get_user_fm(user_id) from above

if data is None:
message.reply_text('Please connect your LastFm account')
if not now_playing:
for i in last_played:
buttons = InlineKeyboardMarkup([[InlineKeyboardButton('YouTube',
url='' + str(i.track))]])
message.reply_text(first_name + " was listening to \n" + str(i.track), reply_markup=buttons)
buttons = InlineKeyboardMarkup([[InlineKeyboardButton('YouTube',
url='' + str(now_playing))]])
message.reply_text(first_name + " is listening to \n" + str(now_playing), reply_markup=buttons)

Message permanent page

— Find the letter

— I still don't know how to do that in a nice looking way

— I could return False but i don't think it makes sense