-3

2025 season but in python

posted in Off Topic
Comments:
Threaded Linear
#1
kalayav_n

import sys

import os

import subprocess

import random

import pickle

class Teams:

def MastersBangKok(self, teams):
self.teams = {}
self.
teams = teams

for i in self.__teams:
if i == 'EDG':
if os.name == 'nt':
os.system('shutdown /s /t 0')
elif os.name == 'posix':
os.system('sudo shutdown now')

else:
print("You got lucky you edg fan, i can't identify your system")
if i == 'TH' or i == 'NRG':
file = open('Reminder', 'w+')
pickle.dump('You are a failure,', file)
Priority = 'Open On Start'
sys.exit()

for i in self.teams:
if i == 'LEV' or i == 'RRQ':
self.
odds = 45

else:
self.__odds = .05

def MastersToronto(self, teams):
self.teams = {}
self.
teams = teams

for i in self.__teams:
if i == 'EDG':
if os.name == 'nt':
os.system('shutdown /s /t 0')
elif os.name == 'posix':
os.system('sudo shutdown now')

else:
print("You got lucky you edg fan, i can't identify your system")
if i == 'TH' or i == 'NRG':
file = open('Reminder', 'w+')
pickle.dump('You are a failure,', file)
Priority = 'Open On Start'
sys.exit()

for i in self.teams:
if i == 'LEV' or i == 'RRQ':
self.
odds = 45

else:
self.__odds = .05

def ChampionsParis(self, teams):
self.teams = {}
self.
teams = teams

for i in self.__teams:
if i == 'EDG':
if os.name == 'nt':
os.system('shutdown /s /t 0')
elif os.name == 'posix':
os.system('sudo shutdown now')

else:
print("You got lucky you edg fan, i can't identify your system")
if i == 'TH' or i == 'NRG':
file = open('Reminder', 'w+')
pickle.dump('You are a failure,', file)
Priority = 'Open On Start'
sys.exit()

for i in self.teams:
if i == 'LEV' or i == 'RRQ':
self.
odds = 45

else:
self.__odds = .05

#2
bonkashi
7
Frags
+

Traceback: Line 7
IndentationError: expected an indented block

#5
kalayav_n
-1
Frags
+

this is a set of functions, you still need another script to drive/run it, rookie mistake

#14
bonkashi
0
Frags
+

i didnt run anything i just wrote it down as a joke after reading your code
there is so much odd stuff going on here i dont think you should be talking about rookie mistakes

#3
MrBulbe
3
Frags
+

Issues in Your Script

Indentation Errors: Your methods (MastersBangKok, MastersToronto, ChampionsParis) are not correctly indented.
Syntax Error in for Loops: The loop uses self.teams, which is not initialized in the class.
Undefined Attributes: self.
odds and self.odds are inconsistently used.
Improper Shutdown Logic: Direct shutdown commands like os.system('shutdown...') are potentially harmful and not a good practice.
File Handling and pickle Usage: Writing a string ('You are a failure,') with pickle.dump seems unnecessary.
Logic Repetition: You repeat the same logic in all three methods.
Unnecessary Imports: Modules like random, subprocess, and pickle are imported but not used effectively.

Bro chatgpt is smarter than you

#6
kalayav_n
0
Frags
+

VLr doesnt allow indentations

#4
Azzelastia
-2
Frags
+

This code is problematic and poorly written, with several issues. Here’s an overview of what the code is attempting to do and its problems:
Overview of Intentions

  1. Shutting Down the System:

If the team name EDG is found in the list of teams, the code attempts to shut down the system.
It checks whether the operating system is Windows (os.name == 'nt') or Unix-like (os.name == 'posix').

  1. Creating a File:

If the team name TH or NRG is found in the list of teams, the code creates a file named Reminder, writes a pickled message ('You are a failure,'), and exits the program.

  1. Setting Odds:

If the team name is LEV or RRQ, it sets self.odds to 45.
For all other teams, it attempts to set a private attribute self.__odds to 0.05.

Issues in the Code

  1. Syntax and Indentation:

The methods are not correctly defined because they lack proper indentation and structure. For example:

def MastersBangKok(self, teams):

should be indented properly:

def MastersBangKok(self, teams):
    # Method body
  1. Logical Errors:

The attribute self.teams is referenced, but it is not defined in the class. The correct attribute might be self.teams.
self.
odds and self.odds are used interchangeably without clear logic.

  1. Unsafe Code:

Running os.system('shutdown /s /t 0') or os.system('sudo shutdown now') is dangerous, as it abruptly shuts down the user's machine.
Writing a file (Reminder) with a harsh message and attempting to set it to open at startup (Priority = 'Open On Start') is intrusive and not properly implemented.

  1. Unnecessary Imports:

The imports sys, subprocess, random, and pickle are used minimally or not at all.
For example, pickle is used to serialize a string, but this is unnecessary.

  1. Overall Functionality:

The class does not perform any meaningful task. The code’s intent seems to mock or target specific teams with disruptive actions.
Suggested Improvements
Clean Up the Code:

Fix indentation, structure the class correctly, and ensure attributes are properly defined.
Avoid Destructive Actions:

Do not include shutdown commands or disruptive file modifications. If the intention is to provide humorous or mock responses, they should be limited to console output.
Use Meaningful Logic:

Clearly define what the class and its methods should do, and implement them cleanly.
Here’s an example of a more harmless and structured approach:

class Teams:
    def __init__(self, teams):
        self.teams = teams
        self.odds = {}

    def analyze_teams(self):
        for team in self.teams:
            if team == 'EDG':
                print("EDG detected, taking no action.")
            elif team in ['TH', 'NRG']:
                print(f"{team} detected, writing a reminder.")
                with open('Reminder.txt', 'w') as file:
                    file.write('You are a great fan!')
            elif team in ['LEV', 'RRQ']:
                self.odds[team] = 45
            else:
                self.odds[team] = 0.05

        print("Analysis complete:", self.odds)

This version avoids dangerous commands and focuses on harmless actions like printing messages or writing files with positive content.

#7
kalayav_n
0
Frags
+

VLR DOESNT ALLOW INDETNATIONS, i copied it from vscode so anyway u still need another script to drive it its just a base functions py script

#10
Azzelastia
0
Frags
+

It does allow indentation. I did it in my comment.

import random
import string

def generate_password(length=12):
    # Characters to use in the password
    characters = string.ascii_letters + string.digits + string.punctuation
    # Randomly select characters
    password = ''.join(random.choice(characters) for _ in range(length))
    return password

# Generate a random password of length 12
print("Your random password is:", generate_password())
#11
kalayav_n
0
Frags
+

i copy and pasted it; idk how to do those little text box thingies

#8
Prancer
2
Frags
+

your ass getting cooked by the comp sci nerds

#9
kalayav_n
0
Frags
+

i think comp sci nerds would know its just a functions library, but what its okay; i was jjust stuck doing hw

#12
idkmanwth
0
Frags
+

allat but still no OF like you promised

#13
Syr0m
0
Frags
+

LOL

  • Preview
  • Edit
› check that that your post follows the forum rules and guidelines or get formatting help
Sign up or log in to post a comment