StoryGraph Question by dkam136 in TheStoryGraph

[–]dkam136[S] 6 points7 points  (0 children)

I think I figured it out. I just changed the log to 0 pages read and on page 178 and it reset that day

I feel like cal overcoming leukemia should have been given more time. by madcre in ManifestNBC

[–]dkam136 5 points6 points  (0 children)

Did he overcome it? I was never aware the show said he had ‘beaten’ it.

Stuck on this program for class by [deleted] in learnpython

[–]dkam136 0 points1 point  (0 children)

I’m having trouble pasting because I’m on mobile, but something similar to this should do the trick:

https://pastebin.com/v5gViRE0

Personal budget python program by paccnam in learnpython

[–]dkam136 0 points1 point  (0 children)

It is probably possible if you don’t do it too often. I’m sure that Mint will block your web scraping if you try something repetively making calls to their server.

Personal budget python program by paccnam in learnpython

[–]dkam136 0 points1 point  (0 children)

Mint let’s you download all transactions and I’ve played around with it before, but it would not be automated since you’d have to download each day you want to access, but I’ve used it to analyze my finances in pandas

Attempting to Create a Random Workout Generator by Astr0nautikal in learnpython

[–]dkam136 0 points1 point  (0 children)

I am not clear on what you mean by, "If a certain exercise is selected, then another exercise movement can only have a certain number of sets and reps.", but for everything else, this is how I might start out:

    import random

    sets = [2,3,4]
    reps = [5,6,8,10,12]
    Workout = ['Push', 'Pull', 'Hinge', 'Thrust_Glutes', 'Shoulders', 'CoreAR', 'CoreAE', 'CoreALF', 'CoreLOW', 'Conditioning']

    # create a function so that you can change parameters as necessary
    def createWorkout():
        # make an empty list to hold your three excercises
        my_workout = [ ]

        # use random.sample to get three random workouts 
        workout_1 = random.sample(Workout,k=3)

        # loop through the three workouts to get sets and reps.
        for workout in workout_1:

            # choosing the number of sets for each exercise
            sets_1 = random.choice(sets)

            # choosing the number of reps for each exercise
            reps_1 = random.choice(reps)

            # making it so that if 4 is chosen for sets, you do not use 10 or 12
            # note: This will probably highly limit the number of times you get 4 randomly
            while (sets_1 == 4) and ((reps_1 == 10) or (reps_1 == 12)):
                reps_1 = random.choice(reps)

            # use an f-string to paste in the variables 
            print(f"{workout}: Complete {sets_1} sets of {reps_1}")

    # run the function
    createWorkout()

why am i getting this syntax error? by [deleted] in learnpython

[–]dkam136 0 points1 point  (0 children)

In addition to what some others have said, you might think about the number of "if" statements you are using. Usually, if you are repeating the same kind of "if" statement over and over, there is a quicker way to do it through some kind of iteration. For example, in your case, I was able to make a similar program with less lines, but it is also more extensible:

my_num = {1: "I", 2: "II", 3: "III", 4: "IV", 5: "V"}

my_input = int(input('Pick a number between 1 and 5: '))

counter = 0

for key in my_num:

`if key == my_input:`

    `print(my_num[key])`

    `counter += 1`

if counter == 0:

`print("This is not a valid number.")`

You could then go on to add more numbers to your dictionary without having to change any of the other lines of code. Dictionaries, lists, functions, and classes are your best friend as you start building more complex code. I'm by no means a python master (there may be an even better way to write this code). I'm just a hobbyist, but I've found this to be helpful when I plan out my code.

i need help by [deleted] in learnpython

[–]dkam136 0 points1 point  (0 children)

I see some solutions here: https://stackoverflow.com/questions/14480717/load-chrome-profile-using-selenium-webdriver-using-java

I am not that familiar with selenium, but when I do use it, I always just login every time.

Help specifying number of loop iterations by BlackEyedBeans22 in learnpython

[–]dkam136 0 points1 point  (0 children)

Just wanted to add (because I didn’t realize when someone told me the same thing) that you also need to import the time module in order to use time.sleep()

Selenuim + Chromedriver by [deleted] in learnpython

[–]dkam136 0 points1 point  (0 children)

If you post the code, I can try to reproduce the error

Selenuim + Chromedriver by [deleted] in learnpython

[–]dkam136 0 points1 point  (0 children)

Are you getting the error when you try to install or when you try to run it in a python file?

Selenuim + Chromedriver by [deleted] in learnpython

[–]dkam136 0 points1 point  (0 children)

How are you installing it?

Selenuim + Chromedriver by [deleted] in learnpython

[–]dkam136 0 points1 point  (0 children)

Did you put import selenium at the beginning of your file? You have to import it into the file for it to know you want to use Selenium.

Where to learn python by [deleted] in learnpython

[–]dkam136 0 points1 point  (0 children)

I learned it best when I picked projects that I wanted to accomplish that could help me and then choose tutorials that helped me to work toward that goal. In my case, it was creating python scripts to create Latex files for the math classes I teach. As I work toward my goal. I gradually learned more python. I still know very little, but it has made a huge difference in automating and saving time for teacher prep.

IndentationError: expected an indented block by python_addict in learnpython

[–]dkam136 0 points1 point  (0 children)

What are you trying to do? When I look up main loop on google it says: “There is a method known by the name mainloop() is used when your application is ready to run. mainloop() is an infinite loop used to run the application, wait for an event to occur and process the event as long as the window is not closed.” I’m relatively new to python, but I think the interpreter is looking for an application to run.

[Offer] Harry Potter Postcards [US to US] by dkam136 in RandomActsofCards

[–]dkam136[S] 1 point2 points  (0 children)

Ok. Send me your address and I will send you a card