Exercise 1 solution : Python tutorial 121

///Exercise 1 solution : Python tutorial 121

Exercise 1 solution : Python tutorial 121

FavoriteLoadingAdd to favorites

Guys please help this channel to reach 20,000 subscribers. I’ll keep uploading quality content for you.

Python is easy programming language to learn and anyone can learn it, and these tutorials are 100% free in hindi.

You can share this playlist with your brother, sisters and friends. This will surely add some values to their life.

Complete Playlist link –

If you follow this complete playlist of python tutorial surely you will learn everything about python programming language.

This is solution of exercise 1 of chapter 7

Source Code Link –

source

By |2021-02-20T12:32:40+00:00February 20th, 2021|Python Video Tutorials|24 Comments

24 Comments

  1. Mayannk N February 20, 2021 at 12:32 pm - Reply

    why every time it seems so easy, when you do it 😉

  2. Amith Suryan February 20, 2021 at 12:32 pm - Reply

    is this correct, i am getting same output

    def cube(n):

    num_cube = {}

    for i in range(1,n+1):

    j = i**3

    more_info = {i :j}

    num_cube.update(more_info)

    return num_cube

  3. Darsh Jain February 20, 2021 at 12:32 pm - Reply

    I created exactly same function. Even the list and function names were same.

  4. Yaseen Hothi February 20, 2021 at 12:32 pm - Reply

    Sir is it the complete python course basic and advanced?

  5. RAJESH PRAJAPATI February 20, 2021 at 12:32 pm - Reply

    user = {}

    n = int(input("Enter the number"))

    for i in range(1,n+1):

    user.update({i:i**3})

    print(user)

  6. Crazy Techy February 20, 2021 at 12:32 pm - Reply

    I did like this: –

    Number = 5

    def Cube_Finder(N):

    Cubed = {

    }

    i = 1

    while i <= N:

    Cubed[i] = i*i*i

    i += 1

    return Cubed

    print(Cube_Finder(Number))

  7. Arti Sharma February 20, 2021 at 12:32 pm - Reply

    def cube(n):

    dic={}

    p=int(n)

    for i in range(1, p+1):

    dic[i]=i**3

    return print(dic)

    n = input("enter num")

    cube(n)

    output
    enter num35

    {1: 1, 2: 8, 3: 27, 4: 64, 5: 125, 6: 216, 7: 343, 8: 512, 9: 729, 10: 1000, 11: 1331, 12: 1728, 13: 2197, 14: 2744, 15: 3375, 16: 4096, 17: 4913, 18: 5832, 19: 6859, 20: 8000, 21: 9261, 22: 10648, 23: 12167, 24: 13824, 25: 15625, 26: 17576, 27: 19683, 28: 21952, 29: 24389, 30: 27000, 31: 29791, 32: 32768, 33: 35937, 34: 39304, 35: 42875}

  8. Mayank Verma February 20, 2021 at 12:32 pm - Reply

    sir user input karwaya kro na

  9. Hacker Khan February 20, 2021 at 12:32 pm - Reply

    MY CODE:

    def cube_finder(n):
    _dict = {}
    for i in range(1, n+1):
    _dict.update({i : i **3})
    return _dict
    print(cube_finder(3))

    OUTPUT: 1:1 , 2: 8, 3:27

  10. Kripamoy Patra February 20, 2021 at 12:32 pm - Reply

    check This pls..
    n=int(input("Enter a no: "))
    def cube_finder(n):
    d={}
    for i in range(1,n+1):
    d1=dict.fromkeys([i],i**3)
    d.update(d1)
    return d
    print(cube_finder(n))

  11. We Can February 20, 2021 at 12:32 pm - Reply

    thanks me by subscribing my channel 🙂

    t = int(input("enter the num of term"))

    i = 1

    case = {}

    while i<=t:

    case[i] = i**3
    i+=1

    print(case)

  12. Ashish Kumar February 20, 2021 at 12:32 pm - Reply

    Mera sahi ho gaya ek baar me

  13. Akshay Pawar February 20, 2021 at 12:32 pm - Reply

    More. Exampl

  14. das vishal February 20, 2021 at 12:32 pm - Reply

    bhai yeh error aa rha h ——–> UnboundLocalError: local variable 'i' referenced before assignment

  15. Pratik Chaudhari February 20, 2021 at 12:32 pm - Reply

    n=int(input("enter the number "))
    def cube_finder(l):

    cube_f={}
    cube={}
    i=1
    while i<l or i==l:
    cube[i]=i**3
    cube_f.update(cube)
    i=i+1
    return cube_f
    print(cube_finder(n))

  16. sagar bhagat February 20, 2021 at 12:32 pm - Reply

    #cube finder

    def cube_finder(n):

    cubes={}

    for i in range(1,n+1):

    cubes[i]=i**3

    pass

    return cubes

    print(cube_finder(5))

  17. MusiC BeAsT February 20, 2021 at 12:32 pm - Reply

    Printed dictionary showing last added value not all. Why it is happened? Even though i write the same code as in tutorial. Please Help me. Here is the code:-
    n = int(input('Enter a number: '))

    def cubic_fuc(j):

    for i in range(1,j+1):

    cubic = {}

    cubic[i] = i**3

    print(cubic)

    # print(cubic_fuc(n))

    cubic_fuc(n)

  18. X Men February 20, 2021 at 12:32 pm - Reply

    def cube(n):

    cubesDict = {}

    for i in range (1,n+1):

    cubesDict.update({i:i*i*i})

    return cubesDict;

  19. Ayush Goyal February 20, 2021 at 12:32 pm - Reply

    num = dict.fromkeys(range(1,11),'unkown')

    new = {}

    for i in num:

    new[i] = i**3
    print(new)

  20. Sai kiran February 20, 2021 at 12:32 pm - Reply

    def cube(n):
    a=dict.fromkeys(range(1,n+1),1)
    for i in a:
    b={i:i**3}
    a.update(b)
    return a
    print(cube(3))#{1:1,2:8,3:27}

  21. huzefa khan February 20, 2021 at 12:32 pm - Reply

    sir i want more example in dictionary

  22. amar lukade February 20, 2021 at 12:32 pm - Reply

    ### exercise 1 .. #definf function which wil take num and give cube in the form of dictionary. – {1: 3, 2: 6, 3: 9}
    def cube_finder(a):
    i=1
    d={}
    while i <= a :
    d[i]=i*3
    i += 1
    return(d)

    print(cube_finder(3)) #{1: 3, 2: 6, 3: 9}

  23. incridible expendables February 20, 2021 at 12:32 pm - Reply

    Bhai samaj ni aya ,cubes[i] =i**3 kese?

  24. 1PIECEBTC : LEARN TO GROW February 20, 2021 at 12:32 pm - Reply

    Bhai aur kitne Dino me uploaded hoge

Leave A Comment

*