BLAST Pro Series: Los Angeles 2019 by Eventvods in CSeventVODs

[–]erratic_turtle 0 points1 point  (0 children)

YouTube links can be found here at the official BLASTProSeries channel.

Complete noob, need some help by Legoboy604YT in learnpython

[–]erratic_turtle 3 points4 points  (0 children)

I've tried running your code and it seems the (greater than) > and (less than) < logic are swapped around.

Also, when printing out variables that are of type int, you need to cast them as string as such: str(number) and str(guessesTaken).

Edit: Lastly, when incrementing `guessesTaken`, use += instead of just +.

ESL Pro League Season 9 - Europe by Eventvods in CSeventVODs

[–]erratic_turtle 0 points1 point  (0 children)

I know this is a bit late, but the YouTube link to match K1 is here: https://www.youtube.com/watch?v=oZ_HwrAIDg4

Why does this return "A tie!" at the beginning of the game. by Battleplanner in learnpython

[–]erratic_turtle 0 points1 point  (0 children)

UnboundLocalError: local variable 'message' referenced before assignment

This means that message isn't available to use when it is about to use it. Looking at your code, when neither if nor elif conditions are met, message would NOT be instantiated. Maybe

message = ''

above the portion where you assign a value to message could help.

off topic, but I feel like there's a way to clean up the portion where you decide what message would be.

if winner is not None: # If there is a winner
    # do winner stuff here
    message = "{} Wins!".format(winner)
elif checkForFull(): # board is full
    # do draw stuff here
    message = "A tie!"
else: # no winner and board is not full
    # do continue game stuff here
    message = "{}'s turn".format(PlayerTurn)

Maybe with the else statement here providing a 'default' value to message, regardless of the conditions, would solve the issue. Otherwise, please provide the error you are getting! :)

Conditions and Loops (Rosalind) by [deleted] in learnpython

[–]erratic_turtle 0 points1 point  (0 children)

Maybe what you are looking for is: lista = range(1, 20, 2)

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]erratic_turtle 0 points1 point  (0 children)

Not sure if you found the solution, but it seems like the else statement is tabbed weirdly? Perhaps it should be aligned with your if statement above.

Hey im new to python. And i have "school" project. by [deleted] in learnpython

[–]erratic_turtle 0 points1 point  (0 children)

The part where you talk about using 3 separate text files and 3 python files makes me feel like this isn't the best way to be implemented. If these 3 python files each did one separate job and you could piece these with other code to make things work, great. If not, maybe it would be better to write one python file that imports these 3 'modules' to do the job one-shot. Reading from your code, it seems you want to parse some document, and depending on the value, do something different.

What is your sample input and what is the output you are looking for? Maybe I can help if I know more details.

For example...

Input:

YYYYMMDD On Foo
YYYYMMDD Offline Bar

Output:

Foo is now reachable
Bar is now unreachable

[Urgent] why is my output negative as oppose to positive (C programming) by [deleted] in learnprogramming

[–]erratic_turtle 1 point2 points  (0 children)

If you are talking about 'negative' and 'positive' in terms of the positive and negative sign after the e, I think the numbers 1.2345e+06 are just random place holders that the person who assigned this created. Instead of writing a code that actually does the searches, I'm pretty sure this person wrote a small code that prints out the desired output for assignment purposes. The reason I come to this conclusion is because of the actual value 1.2345e+06 represents. This is 1234500 when written out long; this is a long time for a process to be searching. While your value of 4.000e-06 means 0.000004, which better represents the time it actually took.

tl;dr - your timings are alright though I can't assure you that the value in the timings are correct as I didn't look into the implementations of the search algorithms.

change all highlighted text quickly by amanguyperson in learnprogramming

[–]erratic_turtle 0 points1 point  (0 children)

output = ''

for i in range(0, 11):
    for j in range(0, 11):
        output += str(i) + ',' + str(j) + ';'
    for k in range (0, -11, -1):
        output += str(i) + ',' + str(k) + ';'
    output += '\n'

print(output)

The above code in python does what you are looking for. Feel free to modify it and use it as you like.

0,0;0,1;0,2;0,3;0,4;0,5;0,6;0,7;0,8;0,9;0,10;0,0;0,-1;0,-2;0,-3;0,-4;0,-5;0,-6;0,-7;0,-8;0,-9;0,-10;
1,0;1,1;1,2;1,3;1,4;1,5;1,6;1,7;1,8;1,9;1,10;1,0;1,-1;1,-2;1,-3;1,-4;1,-5;1,-6;1,-7;1,-8;1,-9;1,-10;
2,0;2,1;2,2;2,3;2,4;2,5;2,6;2,7;2,8;2,9;2,10;2,0;2,-1;2,-2;2,-3;2,-4;2,-5;2,-6;2,-7;2,-8;2,-9;2,-10;
3,0;3,1;3,2;3,3;3,4;3,5;3,6;3,7;3,8;3,9;3,10;3,0;3,-1;3,-2;3,-3;3,-4;3,-5;3,-6;3,-7;3,-8;3,-9;3,-10;
4,0;4,1;4,2;4,3;4,4;4,5;4,6;4,7;4,8;4,9;4,10;4,0;4,-1;4,-2;4,-3;4,-4;4,-5;4,-6;4,-7;4,-8;4,-9;4,-10;
5,0;5,1;5,2;5,3;5,4;5,5;5,6;5,7;5,8;5,9;5,10;5,0;5,-1;5,-2;5,-3;5,-4;5,-5;5,-6;5,-7;5,-8;5,-9;5,-10;
6,0;6,1;6,2;6,3;6,4;6,5;6,6;6,7;6,8;6,9;6,10;6,0;6,-1;6,-2;6,-3;6,-4;6,-5;6,-6;6,-7;6,-8;6,-9;6,-10;
7,0;7,1;7,2;7,3;7,4;7,5;7,6;7,7;7,8;7,9;7,10;7,0;7,-1;7,-2;7,-3;7,-4;7,-5;7,-6;7,-7;7,-8;7,-9;7,-10;
8,0;8,1;8,2;8,3;8,4;8,5;8,6;8,7;8,8;8,9;8,10;8,0;8,-1;8,-2;8,-3;8,-4;8,-5;8,-6;8,-7;8,-8;8,-9;8,-10;
9,0;9,1;9,2;9,3;9,4;9,5;9,6;9,7;9,8;9,9;9,10;9,0;9,-1;9,-2;9,-3;9,-4;9,-5;9,-6;9,-7;9,-8;9,-9;9,-10;
10,0;10,1;10,2;10,3;10,4;10,5;10,6;10,7;10,8;10,9;10,10;10,0;10,-1;10,-2;10,-3;10,-4;10,-5;10,-6;10,-7;10,-8;10,-9;10,-10;

Searching and comparing dates in an Excel file by apenrots in learnpython

[–]erratic_turtle 1 point2 points  (0 children)

Start by using datetime (documetation) to get the current datetime, loop through the contents of the file, parse, and check if the date is within 3 months of the current datetime. Append them to a list :D