https://app.programiz.pro/community-challenges/challenge/

SOME HARD CHALLENGES FOR ME


 https://app.programiz.pro/community-challenges/challenge/flatten-nested-list-iterator/info 

Problem Chalange


SOLUTION
Note: same function is used in the function recursivly 

def flatten_nested_list(nested_list):
    rl=[]
    for item in nested_list:
        if type(item) == list:
            rl.extend(flatten_nested_list(item))
        else:
            rl.append(item)
    return rl

Problem Challenge

solution:
def convert_to_title(n):
    result=''
    no26 = 0
    r = n -26
    while r > 0:
        no26+=1
        r = r -26
    alpha1=''
    if no26 > 0:
        alpha1=chr(64+no26)
        alpha2=chr(64+n-(26*no26))
    else:
        alpha2=chr(64+n)

    return alpha1+alpha2



Problem Challenge



 Solution 
Used two main functions
        1. To convert string to date datetime.strptime(strdate,format) is used
        2, To convert from date to string format datetime.strftime(date, format) is used

from datetime import datetime

def convert_date_format(date):

    mdate=datetime.strptime(date,'%d-%m-%Y')

    return datetime.strftime(mdate,'%m-%d-%Y')




Comments

Popular posts from this blog

PANDAS micro course by www.Kaggle.com https://www.kaggle.com/learn/pandas

Course No 2 Using Python to Interact with the Operating System Rough Notes

Introduction to Git and GitHub https://www.coursera.org/learn/introduction-git-github/