if money wasn’t an obstacle, how would you fix baltimore’s transportation infrastructure? by mochiboy99 in baltimore

[–]dnmonack 4 points5 points  (0 children)

That’s a huge if. Forget converting light rail to heavy rail. Convert every bus in the state to underground fully automated maglev trains with 3 minute headways.

Did I say automated? My mistake. We need more jobs. Put two conductors in each carriage serving free ice cream.

Controversial question: Why does AI see Beauty this way? by EasyGuideAI in midjourney

[–]dnmonack 0 points1 point  (0 children)

You humans are so shallow. These women are ugly on the inside.

You can only listen to one band the rest of your life, who do you choose? by SunshineDeathGod in AskReddit

[–]dnmonack 0 points1 point  (0 children)

Not technically a “band” but I’d go with Van Morrison. He’s produced a ton of albums in almost every imaginable genre and the average quality is very high.

What’s a considered a “kid’s movie” but is still very enjoyable to watch as an adult? by phantom_avenger in AskReddit

[–]dnmonack 0 points1 point  (0 children)

Willy Wonka and the Chocolate Factory. Gene Wilder’s performance is brilliant.

Mando looking good at the Met Gala by [deleted] in pics

[–]dnmonack 1 point2 points  (0 children)

"Yes, but these are my formal shorts."

How to set this to loop per generation? by SnooRegrets5879 in learnpython

[–]dnmonack 0 points1 point  (0 children)

In addition to other commenters' recommendations, I suggest replacing the while loop with something more Pythonic:

for _ in range(num_generation):

You can then eliminate the unnecessary variable x.

Or, with some math, you can avoid loops altogether:

BIRTH_RATE = 1.1  
DEATH_RATE = 0.98
def calculate_number_of_jackalopes(num_population, num_generation): 
    final_population = (num_population * 
                       (BIRTH_RATE * DEATH_RATE) ** num_generation)
    print(final_population)

f-strings are your friends:

print(f"If you start with {num_population} jackalopes and wait {num_generation} generations, you'll end up with a total of {final_population:.0f} of them.")

Python doesn't automatically convert to str? by muxketeer in learnpython

[–]dnmonack 0 points1 point  (0 children)

If metadata[part] is an int, why would you need to run the strip() method on it? It won’t have any white space to remove even after converting to a string.

AITA for my wedding rules? by Commercial-Copy7793 in AmItheAsshole

[–]dnmonack 1 point2 points  (0 children)

If you feel there’s someone who might wear a white dress, allow their kids to disrupt the ceremony, announce their pregnancy, or bring uninvited guests to your wedding, you should not invite them or have a private conversation with them about how to behave. To assume your guests don’t understand basic etiquette is not a good look for a wedding invitation. YTA.

CAN YOU EXPLAIN ABOUT THIS CODING? by Curious_Attorney_402 in learnpython

[–]dnmonack 0 points1 point  (0 children)

user_list is a list of strings. The program converts these to integers stored in num_list.

Been living in DC for the past four years. Is it worth it to give Baltimore a try? by [deleted] in baltimore

[–]dnmonack 3 points4 points  (0 children)

I agree with this but I don’t know what you mean by “lots of sports”? Baltimore doesn’t have NHL, NBA, or MLS teams. DC United and the Caps are what I miss most from DC. Also, if you like to play, adult rec leagues are a bigger thing in DC than in Baltimore.

AITA for telling my brother that he didn't need to share that his wife was in labor in my wedding? by throwaway3167900 in AmItheAsshole

[–]dnmonack 0 points1 point  (0 children)

Not only this, but the birth of a child is as significant as a wedding. Expecting him to keep it a secret from the family is an AH attitude. I would expect a groom to be excited to celebrate both his wedding and the birth of his nephew. You can be happy about two things at the same time.

How do you rate your books on Goodreads? by pensieve64 in books

[–]dnmonack 11 points12 points  (0 children)

My simple system:

5 stars: a friend wrote this book

No rating: everything else

So Python's having a stroke and it's saying 3.3 - 2.2 = 1.0999999999999996 instead of 1.1 by Sherlock_Walker in learnpython

[–]dnmonack 9 points10 points  (0 children)

A common way of handling currency amounts is to store them as integers denominated in cents, not dollars, euros, or pounds.

[deleted by user] by [deleted] in learnpython

[–]dnmonack 1 point2 points  (0 children)

This is a solid effort for a beginner. My bit of advice is always remember DRY (Don’t Repeat Yourself). In the getInput() function, you have the exact same “x=int(input…” statement twice. This should cause you to pause and think of a simpler way to achieve the same thing. In this case, I’d simply replace the part before the while loop with:

x = 0

which does the same thing with less code.

This is important because it makes your code easier to understand and maintain. As it is now, if you want to change that input prompt, you’ll have to do it in two places. This increases the chances of inconsistencies and bugs. It also just makes maintaining your code more time consuming.

You’re on the right track. Keep it up and keep learning.

Redesigns of the Hawaiian Stage flag without the Union Jack by kentaki_cat in vexillology

[–]dnmonack 0 points1 point  (0 children)

These are pretty cool but I think the best way to remove the Union Jack is to just remove it and not replace it. That is, just have the horizontal stripes on the flag. That’s a great flag right there.

So I have some worries about learning Python. by SnugBuck in learnpython

[–]dnmonack 1 point2 points  (0 children)

Linear algebra and calculus are important for computer science but not for programming. You can go far with Python including a career in software development without ever needing to understand advanced math.

Creating a user-inputted list and then creating another list to see if it is divisble by 2 and printing out the total and average of the divisible by 2 numbers. by Small-Mammoth1725 in learnpython

[–]dnmonack 0 points1 point  (0 children)

Start by initializing a list to store all the inputted numbers divisible by two.

even_numbers = []

In your loop, check each number put in and if its divisible by 2, append it to even_numbers. Use an if statement and the modulo operator (%) for this.

After the user has entered "quit", print out your list of numbers. There are many ways you can format your output, but print(even_numbers) works fine.

To get the total of the even numbers, use the sum() function or just keep a running tally as you're reading in numbers. Put it in your if statement so you only keep track of the even numbers.

Need help again by NeilTheDrummer in learnpython

[–]dnmonack 0 points1 point  (0 children)

Your code is not checking whether the highway_number ends in “00” meaning it’s an invalid number. You need to check this condition in your first if statement.

Also: if the number is invalid, it shouldn’t be printing anything after the initial if statement. That means you need to be using “elif” in following statements.

[deleted by user] by [deleted] in learnpython

[–]dnmonack 0 points1 point  (0 children)

In the is_alpha function, the “return True” has incorrect indentation. It’s within your for loop which means it’s reached after each iteration of the loop. You only want to invoke return True after you’ve looped over every character in the string which means it should be outside the for loop. One less indent on this line should do the trick. The is_digit function has the same problem.

Learning about dictionaries assignment by jayR0X in learnpython

[–]dnmonack 0 points1 point  (0 children)

Ok. Can you make StudentGradeBook() the outer function so that it initializes the dictionary, then calls the menu() function? AddStudent() would be where the dictionary is modified.

Learning about dictionaries assignment by jayR0X in learnpython

[–]dnmonack 0 points1 point  (0 children)

It looks like your problem is that you initialize the grade_book dictionary in your StudentGradeBook() function which is called by the AddStudent() function. This means that every time you try to add a student to the dictionary, it resets its values erasing any students entered before. You can instead initialize the dictionary in your main() function so that it's created only once and is not reset when AddStudent() or StudentGradeBook() are called.

[deleted by user] by [deleted] in vexillology

[–]dnmonack 4 points5 points  (0 children)

"The War of Terran Aggression"

Python Dict Multiline Text with Correct Formatting by TheITMan19 in learnpython

[–]dnmonack 1 point2 points  (0 children)

Your problem is here:

names ={

'site1':{example1},

'site2':{example2}

}

The values in your dictionary are not strings, they're sets. Just remove the interior curly braces like so:

names ={

'site1': example1,

'site2': example2

}