Posts

Showing posts from September, 2014

How to Match with List in Python

months = ['January',           'February',           'March',           'April',           'May',           'June',           'July',           'August',           'September',           'October',           'November',           'December']           def valid_month(month):         if month in months:         return month     else:         return None

How to Find Leap Year with Python

Leap Year def how_to_find_leap_year(year): if (year%4==0 and (not year %100==0 or year%400==0)): return "Leap Year" return "Not Leap Year" print how_to_find_leap_year(1900)  Output  Not Leap Year

Find String in String with Python (sentence, word)

def find_your_word_from_sentence(sentence, word): n=0 while n check = sentence.find(word[n]) if check ==-1: return "Your Word is not found in given sentence." n=n+1 return word print find_your_word_from_sentence('This is city of technolgy, piano and violine also found here', 'techvolatile') Output: techvolatile

Facebook Shedule Status Update

Image
Recently Facebook added a new option Shedule Status Update for Facebook Page only. Hoping that Facebook Shedule Status Update option will come very soon for personal account. If you have any Facebook you can try it.

Find the Biggest Number Witth Python

Option 1: def biggest(a,b,c):     return max(a,b,c) print biggest (43,67,89) Option 2: def bigger (b,c):     if b>c:         return b     return c def biggest(a,b,c):         return bigger(a,bigger(b,c)) print biggest(48,60,17) Both is right

The Biggest Resume Mistakes According to Google's Head of HR

Google Head of HR Laszlo Bock reviewed more than 20,000 resumes in his carrier. He point-out five mistakes. Those are:   Typos      Length      Formatting      Confidential information      Lies According to him about Resume Length : " A good rule of thumb is one page of resume for every ten years of work experience. Hard to fit it all in, right? But a three or four or ten page resume simply won't get read closely. As Blaise Pascal wrote, "I would have written you a shorter letter, but I did not have the time." A crisp, focused resume demonstrates an ability to synthesize, prioritize, and convey the most important information about you. Think about it this way: the *sole* purpose of a resume is to get you an interview. That's it. It's not to convince a hiring manager to say "yes" to you (that's what the interview is for) or to tell your life's story (that's what a patient spouse is for). Your resume is a tool that gets

Make Xperia Album Default rather than Google Photo or other Apps

Image
Sometimes you unintentionally or intentionally make Google Photo or other apps your default Image viewer. Google Photo or other photo viewer Apps are not smooth as like phone's default Apps Album (in Xperia; maybe different name on other Android phone) Solution: Settings > Apps > All > Google+ > Clear defaults I think this solution maybe work for any Android Phone or you can change any Apps according your wish

Python while loop to find Factorials of Number

def factorial (n): m=1 while n>=1: m=m*n n=n-1 return m print factorial(53) Output:4274883284060025564298013753389399649690343788366813724672000000000000

While Loop with Python

While loop is pretty awesome in Python. Lets see an example: def print_numbers(j): #define a function print_numbers i = 0 while (i!=j): i = i+1 #increment print i print_numbers(6) #call the function Output: 1 2 3 4 5 6

Convert any float number to Round number with Python

Sometimes you need to convert float number into round figure. Python has several way to do this 1. With round x = 34354.65756 round(x)  Output:34355.0 You can also define how many number after point. So look this  round(x,4) Output: 34354.6576 round(x,2) Output:34354.66 Another hard way to round float number, this code is found from Udacity. This code provide you no point after the round number. So look this code and code is very interesting x=34354.65756 num=x+0.5 s= str(num) point = s.find('.') print s[:point] Output:34355

How to find String in String using Python

example   about_me= "I am very a sgoode boy" start_link = about_me.find('sgoode') start_quote= about_me.find('s',start_link) #print start_quote end_quote=about_me.find('e',start_quote+1) #print end_quote me = about_me[start_quote+1:end_quote] print me output:good