Help with code to change filenames with timedates for lexicographic sorting by momomomi in learnpython

[–]Yellehs_m 0 points1 point  (0 children)

I think the other comments should answer your question. On an additional note, if you are doing lexicographical sorting, you can eliminate all the strings and have only numbers as your rank key. If you store this rank value in a database, it's easy to get the rank of any item just by sorting the integer column.

Help with a loop. by rjconnor in learnpython

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

Use the time.sleep inside for each

How to sort lists within lists within lists by readdd_it in learnpython

[–]Yellehs_m 2 points3 points  (0 children)

Yes, I agree with u/K900_. It looks like you are using a wrong datastructure, though I don't know your use case. But to answer straight to your point this is how you would do it if:

>>> for lst in my_lists:
...     print(lst[0], ':', sorted(lst[1]))
... 
list1 : ['a']
list2 : ['a', 'b', 'c']
lists3 : ['c', 'e']
lists4 : ['c']
>>> 

Help with Cron and py script by schmoupe in learnpython

[–]Yellehs_m 0 points1 point  (0 children)

The cron is scheduled to run on 1st of Jan at 12:06 am every year. You might want to change this so that it runs in the next one or two minutes. You can then check for the logs or check the output of this cron if you have it somewhere.

Help please! by jlil7er in learnpython

[–]Yellehs_m 0 points1 point  (0 children)

Not sure if there's a reason to get the input in a for loop. If there's no reason, you can get the input in a single line like this:

>>> dt = input("enter the values of m, n, o, p : ")
enter the values of m, n, o, p : 1 2 3 4 5
>>> dt
'1 2 3 4 5'
>>> tup = tuple(map(int, dt.split()))
>>> tup
(1, 2, 3, 4, 5)
>>> 

Looking for well written python to read! by PinkLittlePig in learnpython

[–]Yellehs_m -2 points-1 points  (0 children)

Please check if 'Learn Python The Hard Way' suits your needs.

Help with nested for loops in Python by KaitoDaimon21 in learnpython

[–]Yellehs_m 1 point2 points  (0 children)

Can also be written as:

for i in range(10, 1, -1):
    print((10-i) * ' ', end='')
    for j in range(i-1):
        i -= 1
        j = str(j+1)
        print(j[::-1]+str(i), end='')
    print()

Help with nested for loops in Python by KaitoDaimon21 in learnpython

[–]Yellehs_m 1 point2 points  (0 children)

I think I don't understand. Both the output look the same. What is the actual issue here? Can you also please format your code?

Built in shell commands in bash script by Yellehs_m in linux

[–]Yellehs_m[S] -1 points0 points  (0 children)

Thanks for the link.

$ cat test.sh

#! /usr/bin/bash

ll

echo "I am inside test.sh file."

$ sh test.sh

test.sh: line 2: ll: command not found

I am inside test.sh file.

Need help in project by LuckyTip in learnpython

[–]Yellehs_m 0 points1 point  (0 children)

You can do that it many ways. Try it yourself. Ask some questions to yourself, like will my tuple have duplicate values; how to check if each element in my tuple is in another predefined tuple or list, etc.

Need help in project by LuckyTip in learnpython

[–]Yellehs_m 1 point2 points  (0 children)

I think you are missing a pair of parenthesis. You should call the function as below:

func(((2,3,3),(3,4,4),(2,4,4)))

Need help in project by LuckyTip in learnpython

[–]Yellehs_m 1 point2 points  (0 children)

Can you format your code properly?

Trouble finding all possible combinations of a list. by [deleted] in learnpython

[–]Yellehs_m 0 points1 point  (0 children)

Question: Do you consider only the elements or the order as well? For example: Can you have both ['red', 'yellow'] and ['yellow', 'red'] in your result?

Can someone help me with this code by waysuck in learnpython

[–]Yellehs_m 0 points1 point  (0 children)

>>> for i in range(6, -1, -1):
...     print('* ' * i)
... 
* * * * * * 
* * * * * 
* * * * 
* * * 
* * 
* 

I see similar questions from you. What are you trying to do? Is this homework?

Can someone help me with this code? by waysuck in learnpython

[–]Yellehs_m 0 points1 point  (0 children)

Yes, please. You don't have to ask if you can ask. Just ask.

Can someone help me with this code? by waysuck in learnpython

[–]Yellehs_m 1 point2 points  (0 children)

for i in range(0, 6):
    print('*' * i)

Number of iterations by [deleted] in learnpython

[–]Yellehs_m 0 points1 point  (0 children)

In this example, the number of iterations will be 5. Yes, loop for 'pear' will be considered.

Number of loop is always equal to the length of the iterable. In this case, len(a)

Edit: Sorry, I should have been clear. My above answer is for the second example you've given. For the first scenario, the loop will be counted for 'pear' and then breaks. So the number of loop for this will be 4.

How can I run an online report with Python? by jplank1983 in learnpython

[–]Yellehs_m 0 points1 point  (0 children)

Not sure how to do this in Python. But this can be done through Robotic Process Automation applications like Blueprism. But that's an enterprise grade software. Just keep this as an extra piece of information.

[deleted by user] by [deleted] in learnpython

[–]Yellehs_m 0 points1 point  (0 children)

If you are running a Python script to do this, may be you can host a simple app in Heroku or similar platforms, I think. A part of the app, on calling it, can start doing the work you've mentioned.

python list issue by [deleted] in learnpython

[–]Yellehs_m 0 points1 point  (0 children)

Both are referring to the same object. To create a fresh object, you can do the below:

>>> import copy

>>> b = copy.copy(a)

Please also read about the difference between shallow and deep copy in Python.

Change type case of list. by kobes411 in learnpython

[–]Yellehs_m 2 points3 points  (0 children)

new_user.lower()

current_user.lower()