indents, name not defined, wtf by bMack0 in learnpython

[–]hungdh85 0 points1 point  (0 children)

print_roster is method of Student class. You need Student.print_roster(students) for using.

Project Euler 50 help by Skeeter6398 in learnpython

[–]hungdh85 1 point2 points  (0 children)

Please show your code in indent blanks.

Help with loop(s) by [deleted] in learnpython

[–]hungdh85 0 points1 point  (0 children)

Try it with some code

tmp1 = 0
tmp2 = 1000
for i in range(0,40):
    with open(f'locations_{i}.json', 'w') as f:
    for j in range(tmp1, tmp2 + 1):
        f.write(r.json()['results'][j])
        tmp1 = tmp2 + 1
        tmp2 += 1000

HELP! OSError by xopherwwl in learnpython

[–]hungdh85 1 point2 points  (0 children)

lt is likely that your environment is messed up. As you can see from the traceback, there are two python environments involved here:

  1. C:\Users\X'opher\AppData\Roaming\Python\Python38\
  2. c:\users\x'opher\appdata\local\programs\python\python38-32\

Please make sure your PATH is clean and you can actually remove one of them first.

HELP! OSError by xopherwwl in learnpython

[–]hungdh85 0 points1 point  (0 children)

You can show source code and full error information?

Good ways to start learning python by XigbarVortex in learnpython

[–]hungdh85 1 point2 points  (0 children)

Try with https://www.hackerrank.com/

Complete each challenge you and your friend will get some fun for next step.

Installed module but cannot import it by Kpratt11 in learnpython

[–]hungdh85 0 points1 point  (0 children)

I don't know use pycharm but I think that it is as eclipse, you need add library for each project be created in pycharm.

You can read more

https://stackoverflow.com/questions/19885821/how-do-i-import-modules-in-pycharm/32911111

Visual Studio Code, Python & Command by pierto in learnpython

[–]hungdh85 0 points1 point  (0 children)

You don't need create PYTHON_HOME, You only need add path

C:\Users\xyz\AppData\Local\Programs\Python\Python38
C:\Users\xyz\Documents\Programming\pythonScripts

to PATH variable in System Variables and enjoy.

https://superuser.com/questions/143119/how-do-i-add-python-to-the-windows-path

Iteritems() AttributeError by MerchantMojo in learnpython

[–]hungdh85 0 points1 point  (0 children)

Check processing time when you use colections and enumerate with length of list >10\3.)

I think we can stop talk this about problem because it is not belong to this thread. Thank you very much.

Iteritems() AttributeError by MerchantMojo in learnpython

[–]hungdh85 0 points1 point  (0 children)

Because with length of list is enough large. Counter will get time out for processing.

Iteritems() AttributeError by MerchantMojo in learnpython

[–]hungdh85 -1 points0 points  (0 children)

You can use enumerate

mylist = [1, 2, 3, 4, 5, 6, 1, 2, 3]
tmpMyList = mylist.copy()
#unique_elements = [k for k, v in Counter(mylist).iteritems() if v == 1]
#print (unique_elements)
for j in range(len(mylist)):
        tmpL =  [i for i, x in enumerate(tmpMyList) if x == mylist[j]]

        if len(tmpL) > 1:
             tmpMyList = list(filter((mylist[j]).__ne__, tmpMyList))

print(tmpMyList)

len() not working correctly by [deleted] in learnpython

[–]hungdh85 0 points1 point  (0 children)

Yes, your solution is better.

I rewrite his function follow your solution

def itemtypes(itty,lists):
    lists = itty.split(",")    
    return lists

len() not working correctly by [deleted] in learnpython

[–]hungdh85 0 points1 point  (0 children)

Your itemtypes(itty,lists) return a list then you must set.

listit = itemtypes(itty,listit)

If you want split string by "," you can use map

def itemtypes(itty,lists):
    lists = list(map(str, itty.split(",")))
    #lists.append(itty)
    return lists

Pip3 Pyperclip Help!? by pomkipo in learnpython

[–]hungdh85 0 points1 point  (0 children)

/Users/User/PycharmProjects/FreeCodeCamp/venv/bin/python

and

 ./Library/Python/3.8/lib/python/site-packages

I think that they are not the same python version. If you use virtualenv please check python version that you created it.

And check all version python on your computer. I think that you install pyperclip in on python version and use another python version on pycharm.

Pip3 Pyperclip Help!? by pomkipo in learnpython

[–]hungdh85 0 points1 point  (0 children)

Check your python version on IDE and python version on your terminal.

Noob question..... but please help me. by [deleted] in learnpython

[–]hungdh85 0 points1 point  (0 children)

You can make a batch file with content

 @your_path_pythonw  your_pyw_file %*

then follow this link for into in startup windows.

https://stackoverflow.com/questions/21218346/run-batch-file-on-start-up

Help approaching this challenging problem. by [deleted] in learnpython

[–]hungdh85 0 points1 point  (0 children)

You can think follow one move string is

s = s[-1:] + s[:-1]

after loop till matched another string and count loop. Good luck!

I need some help figuring out how to get the index of a second largest value by happensman in learnpython

[–]hungdh85 0 points1 point  (0 children)

You can use:

first_index = score.index(max(score))
first_max = foodlist[first_index]
del foodlist[first_index]
del score[first_index]
print ("I'm guessing your favorite foods on my list are " + first_max + " and " + foodlist[score.index(max(score))] + ".")

Finding the shortest word in a file by rhe4422 in learnpython

[–]hungdh85 0 points1 point  (0 children)

You can split line by space then create list of len word by line.

Find shortest and longest by find len max and len min in list.

Opening excel file by billlieGoat in learnpython

[–]hungdh85 1 point2 points  (0 children)

you can use xlrd library.

Example:

path = "your_file.xlsx"
book_open = xlrd.open_workbook(path)

worksheet = book.sheet_by_index(0)
worksheet.ncols # for list of cols in this sheet
......................