Skip to content

update template

update template #1

Triggered via push December 11, 2023 12:02
Status Success
Total duration 24s
Artifacts

lint.yml

on: push
Run linters
15s
Run linters
Fit to window
Zoom out
Zoom in

Annotations

100 errors and 1 warning
/home/runner/work/PythonProjects/PythonProjects/Alarm Clock/test_alarm.py#L1
import unittest import alarm_clock from datetime import * + + class MyTestCase(unittest.TestCase): def test_alarm(self): current_time = datetime.now() min = current_time.minute hour = current_time.hour - current_time_as_string = str(hour) + ':' + str(min) - self.assertEqual(False, alarm_clock.alarm(current_time_as_string)) # add assertion here + current_time_as_string = str(hour) + ":" + str(min) + self.assertEqual( + False, alarm_clock.alarm(current_time_as_string) + ) # add assertion here -if __name__ == '__main__': +if __name__ == "__main__": unittest.main()
/home/runner/work/PythonProjects/PythonProjects/CoffeeMachine2.0/main.py#L17
still_on = False else: drink = m.find_drink(s) if cm.is_resource_sufficient(drink) and mm.make_payment(drink.cost): cm.make_coffee(drink) - - -
/home/runner/work/PythonProjects/PythonProjects/Alarm Clock/alarm_clock.py#L1
from time import * from datetime import * -'''Check input string against current time''' +"""Check input string against current time""" + + def alarm(alarm_time): - time_list = alarm_time.split(":") current_time = datetime.now().time() current_time_min = current_time.minute current_time_hour = current_time.hour sleep(10)
/home/runner/work/PythonProjects/PythonProjects/Alarm Clock/alarm_clock.py#L21
def main(): alarm_time = input("Enter time in 24 hours format: hh:mm\n") while alarm(alarm_time): pass - print(f'Wake Up!!!') + print(f"Wake Up!!!") if __name__ == "__main__": - main() + main()
/home/runner/work/PythonProjects/PythonProjects/CoffeeMachine2.0/coffee_maker.py#L1
class CoffeeMaker: """Models the machine that makes the coffee""" + def __init__(self): self.resources = { "water": 300, "milk": 200, "coffee": 100,
/home/runner/work/PythonProjects/PythonProjects/Guess-the-number-game/logo.py#L1
-image = ''' +image = """ _________ _____________ _____ __ ______ ______ __ ____/___ _____________________ ___ __/__ /______ ___ | / /___ ________ ______ /________________ / _ / __ _ / / / _ \_ ___/_ ___/ __ / __ __ \ _ \ __ |/ /_ / / /_ __ `__ \_ __ \ _ \_ ___/_ / / /_/ / / /_/ // __/(__ )_(__ ) _ / _ / / / __/ _ /| / / /_/ /_ / / / / / /_/ / __/ / /_/ \____/ \__,_/ \___//____/ /____/ /_/ /_/ /_/\___/ /_/ |_/ \__,_/ /_/ /_/ /_//_.___/\___//_/ (_) -''' +"""
Alarm Clock/alarm_clock.py#L1
'from time import *' used; unable to detect undefined names (F403)
/home/runner/work/PythonProjects/PythonProjects/CoffeeMachine2.0/menu.py#L1
class MenuItem: """Models each Menu Item.""" + def __init__(self, name, water, milk, coffee, cost): self.name = name self.cost = cost - self.ingredients = { - "water": water, - "milk": milk, - "coffee": coffee - } + self.ingredients = {"water": water, "milk": milk, "coffee": coffee} class Menu: """Models the Menu with drinks.""" + def __init__(self): self.menu = [ MenuItem(name="latte", water=200, milk=150, coffee=24, cost=2.5), MenuItem(name="espresso", water=50, milk=0, coffee=18, cost=1.5), MenuItem(name="cappuccino", water=250, milk=50, coffee=24, cost=3),
Alarm Clock/alarm_clock.py#L2
'from datetime import *' used; unable to detect undefined names (F403)
/home/runner/work/PythonProjects/PythonProjects/CoffeeMachine2.0/money_machine.py#L1
class MoneyMachine: - CURRENCY = "$" - COIN_VALUES = { - "quarters": 0.25, - "dimes": 0.10, - "nickles": 0.05, - "pennies": 0.01 - } + COIN_VALUES = {"quarters": 0.25, "dimes": 0.10, "nickles": 0.05, "pennies": 0.01} def __init__(self): self.profit = 0 self.money_received = 0
Alarm Clock/alarm_clock.py#L5
Expected 2 blank lines, found 0 (E302)
Alarm Clock/alarm_clock.py#L8
'datetime' may be undefined, or defined from star imports: datetime, time (F405)
/home/runner/work/PythonProjects/PythonProjects/CoffeeMachine2.0/money_machine.py#L19
def process_coins(self): """Returns the total calculated from coins inserted.""" print("Please insert coins.") for coin in self.COIN_VALUES: - self.money_received += int(input(f"How many {coin}?: ")) * self.COIN_VALUES[coin] + self.money_received += ( + int(input(f"How many {coin}?: ")) * self.COIN_VALUES[coin] + ) return self.money_received def make_payment(self, cost): """Returns True when payment is accepted, or False if insufficient.""" self.process_coins()
Alarm Clock/alarm_clock.py#L11
'sleep' may be undefined, or defined from star imports: datetime, time (F405)
/home/runner/work/PythonProjects/PythonProjects/CurrencyConverter/main.py#L1
import requests + def get_exchange_rate(api_key, from_currency, to_currency): - url = f'https://open.er-api.com/v6/latest/{from_currency}' - params = {'apikey': api_key} - + url = f"https://open.er-api.com/v6/latest/{from_currency}" + params = {"apikey": api_key} + response = requests.get(url, params=params) if response.status_code == 200: data = response.json() - return data['rates'].get(to_currency) + return data["rates"].get(to_currency) else: - print(f"Error: Unable to fetch exchange rate. Status code: {response.status_code}") + print( + f"Error: Unable to fetch exchange rate. Status code: {response.status_code}" + ) return None + def convert_currency_with_api(amount, from_currency, to_currency, api_key): exchange_rate = get_exchange_rate(api_key, from_currency, to_currency) if exchange_rate is not None: converted_amount = amount * exchange_rate - result = f"{amount} {from_currency} is equal to {converted_amount} {to_currency}" + result = ( + f"{amount} {from_currency} is equal to {converted_amount} {to_currency}" + ) return result else: return "Conversion failed." + # Example usage: -api_key = 'your_exchange_rate_api_key' +api_key = "your_exchange_rate_api_key" amount_to_convert = float(input("Enter the amount to convert: ")) from_currency = input("Enter the source currency in ISO code: ") to_currency = input("Enter the target currency in ISO code: ") -result = convert_currency_with_api(amount_to_convert, from_currency, to_currency, api_key) +result = convert_currency_with_api( + amount_to_convert, from_currency, to_currency, api_key +) print(result)
Alarm Clock/alarm_clock.py#L26
F-string is missing placeholders (F541)
Alarm Clock/alarm_clock.py#L30
No newline at end of file (W292)
/home/runner/work/PythonProjects/PythonProjects/Hangman-Game/hangman_art.py#L1
-stages = [''' +stages = [ + """ +---+ | | O | /|\ | / \ | | ========= -''', ''' +""", + """ +---+ | | O | /|\ | / | | ========= -''', ''' +""", + """ +---+ | | O | /|\ | | | ========= -''', ''' +""", + """ +---+ | | O | /| | | | -=========''', ''' +=========""", + """ +---+ | | O | | | | | ========= -''', ''' +""", + """ +---+ | | O | | | | ========= -''', ''' +""", + """ +---+ | | | | | | ========= -'''] +""", +] -logo = ''' +logo = """ _ | | | |__ __ _ _ __ __ _ _ __ ___ __ _ _ __ | '_ \ / _` | '_ \ / _` | '_ ` _ \ / _` | '_ \ | | | | (_| | | | | (_| | | | | | | (_| | | | | |_| |_|\__,_|_| |_|\__, |_| |_| |_|\__,_|_| |_| __/ | - |___/ ''' - - - + |___/ """
Alarm Clock/test_alarm.py#L3
'from datetime import *' used; unable to detect undefined names (F403)
Alarm Clock/test_alarm.py#L4
Expected 2 blank lines, found 0 (E302)
/home/runner/work/PythonProjects/PythonProjects/Guess-the-number-game/main.py#L1
from logo import image import random + print(image) print("Welcome to the number guessing game 🫡") print("I'm thinking of a number between 1 and 100 🧞‍♂️") -n = random.randint(1,100) +n = random.randint(1, 100) # print(n) -#Options for diificulty -option = (input("Type 'easy' or 'hard' for difficulty: ")) +# Options for diificulty +option = input("Type 'easy' or 'hard' for difficulty: ") -if(option == 'easy'): - chance = 10 - flag = False - while(chance>0): - chance-=1 - guess = int(input("Enter your guess? ")) - if(guess>n): - print("Too High\nGuess again") - elif(guess<n): - print("Too Low\nGuess again") - else: - # flag = True - print("Correct Guess!!!") - print(f'The answer is {n}') - break - print(f'You have {chance} attempts remaining to guess the number') - if(chance ==0): - print("You've run out of chances, you lose. 😭") - print(f'The correct answer was {n}') +if option == "easy": + chance = 10 + flag = False + while chance > 0: + chance -= 1 + guess = int(input("Enter your guess? ")) + if guess > n: + print("Too High\nGuess again") + elif guess < n: + print("Too Low\nGuess again") + else: + # flag = True + print("Correct Guess!!!") + print(f"The answer is {n}") + break + print(f"You have {chance} attempts remaining to guess the number") + if chance == 0: + print("You've run out of chances, you lose. 😭") + print(f"The correct answer was {n}") -elif(option == 'hard'): - chance = 5 - flag = False - while(chance>0): - chance-=1 - guess = int(input("Enter your guess? ")) - if(guess>n): - print("Too High\nGuess again") - elif(guess<n): - print("Too Low\nGuess again") - else: - # flag = True - print("Correct Guess!!!") - print(f'The answer is {n}') - break - print(f'You have {chance} attempts remaining to guess the number') - if(chance ==0): - print("You've run out of chances, you lose. 🥲") - print(f'The correct answer was {n}') +elif option == "hard": + chance = 5 + flag = False + while chance > 0: + chance -= 1 + guess = int(input("Enter your guess? ")) + if guess > n: + print("Too High\nGuess again") + elif guess < n: + print("Too Low\nGuess again") + else: + # flag = True + print("Correct Guess!!!") + print(f"The answer is {n}") + break + print(f"You have {chance} attempts remaining to guess the number") + if chance == 0: + print("You've run out of chances, you lose. 🥲") + print(f"The correct answer was {n}") else: - print("Wrong input") + print("Wrong input")
Alarm Clock/test_alarm.py#L6
'datetime' may be undefined, or defined from star imports: datetime (F405)
/home/runner/work/PythonProjects/PythonProjects/Hangman-Game/main.py#L1
import random from hangman_art import stages, logo from hangman_words import word_list -#from replit import clear #for people running it locally, replit package wont work -import os + +# from replit import clear #for people running it locally, replit package wont work +import os print(logo) game_is_finished = False lives = len(stages) - 1
Alarm Clock/test_alarm.py#L11
Line too long (96 > 79 characters) (E501)
/home/runner/work/PythonProjects/PythonProjects/Hangman-Game/main.py#L16
display += "_" while not game_is_finished: guess = input("Guess a letter: ").lower() - - #clear() #Use this when using replit package otherwise the line below - os.system('clear') + # clear() #Use this when using replit package otherwise the line below + os.system("clear") if guess in display: print(f"You've already guessed {guess}") for position in range(word_length):
CoffeeMachine2.0/coffee_maker.py#L17
Line too long (89 > 79 characters) (E501)
/home/runner/work/PythonProjects/PythonProjects/Hangman-Game/main.py#L35
print(f"You guessed {guess}, that's not in the word. You lose a life.") lives -= 1 if lives == 0: game_is_finished = True print("You lose.") - + if not "_" in display: game_is_finished = True print("You win.") - print(stages[lives]) + print(stages[lives])
CoffeeMachine2.0/main.py#L1
'menu.MenuItem' imported but unused (F401)
/home/runner/work/PythonProjects/PythonProjects/HirstPainting/main.py#L1
import colorgram import turtle import random + turtle.colormode(255) new_colors = [] colors = colorgram.extract("Unknown.jpeg", 100) for color in colors: r = color.rgb.r
CoffeeMachine2.0/main.py#L24
Blank line at end of file (W391)
/home/runner/work/PythonProjects/PythonProjects/HirstPainting/main.py#L38
turtle.setheading(180) turtle.fd(500) turtle.setheading(0) screen = turtle.Screen() -screen.exitonclick() +screen.exitonclick()
CoffeeMachine2.0/menu.py#L30
Line too long (118 > 79 characters) (E501)
CoffeeMachine2.0/money_machine.py#L24
Line too long (93 > 79 characters) (E501)
/home/runner/work/PythonProjects/PythonProjects/NATO-alphabet/main.py#L2
# {new_key:new_value for (index, row) in df.iterrows()} import pandas data = pandas.read_csv("nato_phonetic_alphabet.csv") -#TODO 1. Create a dictionary in this format: +# TODO 1. Create a dictionary in this format: phonetic_dict = {row.letter: row.code for (index, row) in data.iterrows()} print(phonetic_dict) -#TODO 2. Create a list of the phonetic code words from a word that the user inputs. +# TODO 2. Create a list of the phonetic code words from a word that the user inputs. word = input("Enter a word: ").upper() output_list = [phonetic_dict[letter] for letter in word] print(output_list)
CurrencyConverter/main.py#L3
Expected 2 blank lines, found 1 (E302)
/home/runner/work/PythonProjects/PythonProjects/PiFiglet/Formatted Text.py#L3
# check font list from fonts.txt font = input("Enter type of font\n") or "slant" text = str(input("Enter your text\n")) or "Text" -with open('fonts.txt') as f: +with open("fonts.txt") as f: arr = f.read().split() if font in arr: result = pyfiglet.figlet_format(text, font=font) print(result) else: - print(f"Sorry {font} font not found. Error 404") + print(f"Sorry {font} font not found. Error 404")
CurrencyConverter/main.py#L6
Blank line contains whitespace (W293)
/home/runner/work/PythonProjects/PythonProjects/PongGame/ball.py#L1
from turtle import Turtle class Ball(Turtle): - def __init__(self): super().__init__() self.shape("circle") self.penup() self.color("light green")
CurrencyConverter/main.py#L13
Line too long (91 > 79 characters) (E501)
/home/runner/work/PythonProjects/PythonProjects/PongGame/ball.py#L22
def move(self): new_x = self.xcor() + self.x_move new_y = self.ycor() + self.y_move self.goto(new_x, new_y) - + def bounce_y(self): self.y_move *= -1 def bounce_x(self): self.x_move *= -1 self.move_speed *= 0.93 - \ No newline at end of file
CurrencyConverter/main.py#L16
Expected 2 blank lines, found 1 (E302)
/home/runner/work/PythonProjects/PythonProjects/Hangman-Game/hangman_words.py#L1
word_list = [ -'abruptly', -'absurd', -'abyss', -'affix', -'askew', -'avenue', -'awkward', -'axiom', -'azure', -'bagpipes', -'bandwagon', -'banjo', -'bayou', -'beekeeper', -'bikini', -'blitz', -'blizzard', -'boggle', -'bookworm', -'boxcar', -'boxful', -'buckaroo', -'buffalo', -'buffoon', -'buxom', -'buzzard', -'buzzing', -'buzzwords', -'caliph', -'cobweb', -'cockiness', -'croquet', -'crypt', -'curacao', -'cycle', -'daiquiri', -'dirndl', -'disavow', -'dizzying', -'duplex', -'dwarves', -'embezzle', -'equip', -'espionage', -'euouae', -'exodus', -'faking', -'fishhook', -'fixable', -'fjord', -'flapjack', -'flopping', -'fluffiness', -'flyby', -'foxglove', -'frazzled', -'frizzled', -'fuchsia', -'funny', -'gabby', -'galaxy', -'galvanize', -'gazebo', -'giaour', -'gizmo', -'glowworm', -'glyph', -'gnarly', -'gnostic', -'gossip', -'grogginess', -'haiku', -'haphazard', -'hyphen', -'iatrogenic', -'icebox', -'injury', -'ivory', -'ivy', -'jackpot', -'jaundice', -'jawbreaker', -'jaywalk', -'jazziest', -'jazzy', -'jelly', -'jigsaw', -'jinx', -'jiujitsu', -'jockey', -'jogging', -'joking', -'jovial', -'joyful', -'juicy', -'jukebox', -'jumbo', -'kayak', -'kazoo', -'keyhole', -'khaki', -'kilobyte', -'kiosk', -'kitsch', -'kiwifruit', -'klutz', -'knapsack', -'larynx', -'lengths', -'lucky', -'luxury', -'lymph', -'marquis', -'matrix', -'megahertz', -'microwave', -'mnemonic', -'mystify', -'naphtha', -'nightclub', -'nowadays', -'numbskull', -'nymph', -'onyx', -'ovary', -'oxidize', -'oxygen', -'pajama', -'peekaboo', -'phlegm', -'pixel', -'pizazz', -'pneumonia', -'polka', -'pshaw', -'psyche', -'puppy', -'puzzling', -'quartz', -'queue', -'quips', -'quixotic', -'quiz', -'quizzes', -'quorum', -'razzmatazz', -'rhubarb', -'rhythm', -'rickshaw', -'schnapps', -'scratch', -'shiv', -'snazzy', -'sphinx', -'spritz', -'squawk', -'staff', -'strength', -'strengths', -'stretch', -'stronghold', -'stymied', -'subway', -'swivel', -'syndrome', -'thriftless', -'thumbscrew', -'topaz', -'transcript', -'transgress', -'transplant', -'triphthong', -'twelfth', -'twelfths', -'unknown', -'unworthy', -'unzip', -'uptown', -'vaporize', -'vixen', -'vodka', -'voodoo', -'vortex', -'voyeurism', -'walkway', -'waltz', -'wave', -'wavy', -'waxy', -'wellspring', -'wheezy', -'whiskey', -'whizzing', -'whomever', -'wimpy', -'witchcraft', -'wizard', -'woozy', -'wristwatch', -'wyvern', -'xylophone', -'yachtsman', -'yippee', -'yoked', -'youthful', -'yummy', -'zephyr', -'zigzag', -'zigzagging', -'zilch', -'zipper', -'zodiac', -'zombie', -] + "abruptly", + "absurd", + "abyss", + "affix", + "askew", + "avenue", + "awkward", + "axiom", + "azure", + "bagpipes", + "bandwagon", + "banjo", + "bayou", + "beekeeper", + "bikini", + "blitz", + "blizzard", + "boggle", + "bookworm", + "boxcar", + "boxful", + "buckaroo", + "buffalo", + "buffoon", + "buxom", + "buzzard", + "buzzing", + "buzzwords", + "caliph", + "cobweb", + "cockiness", + "croquet", + "crypt", + "curacao", + "cycle", + "daiquiri", + "dirndl", + "disavow", + "dizzying", + "duplex", + "dwarves", + "embezzle", + "equip", + "espionage", + "euouae", + "exodus", + "faking", + "fishhook", + "fixable", + "fjord", + "flapjack", + "flopping", + "fluffiness", + "flyby", + "foxglove", + "frazzled", + "frizzled", + "fuchsia", + "funny", + "gabby", + "galaxy", + "galvanize", + "gazebo", + "giaour", + "gizmo", + "glowworm", + "glyph", + "gnarly", + "gnostic", + "gossip", + "grogginess", + "haiku", + "haphazard", + "hyphen", + "iatrogenic", + "icebox", + "injury", + "ivory", + "ivy", + "jackpot", + "jaundice", + "jawbreaker", + "jaywalk", + "jazziest", + "jazzy", + "jelly", + "jigsaw", + "jinx", + "jiujitsu", + "jockey", + "jogging", + "joking", + "jovial", + "joyful", + "juicy", + "jukebox", + "jumbo", + "kayak", + "kazoo", + "keyhole", + "khaki", + "kilobyte", + "kiosk", + "kitsch", + "kiwifruit", + "klutz", + "knapsack", + "larynx", + "lengths", + "lucky", + "luxury", + "lymph", + "marquis", + "matrix", + "megahertz", + "microwave", + "mnemonic", + "mystify", + "naphtha", + "nightclub", + "nowadays", + "numbskull", + "nymph", + "onyx", + "ovary", + "oxidize", + "oxygen", + "pajama", + "peekaboo", + "phlegm", + "pixel", + "pizazz", + "pneumonia", + "polka", + "pshaw", + "psyche", + "puppy", + "puzzling", + "quartz", + "queue", + "quips", + "quixotic", + "quiz", + "quizzes", + "quorum", + "razzmatazz", + "rhubarb", + "rhythm", + "rickshaw", + "schnapps", + "scratch", + "shiv", + "snazzy", + "sphinx", + "spritz", + "squawk", + "staff", + "strength", + "strengths", + "stretch", + "stronghold", + "stymied", + "subway", + "swivel", + "syndrome", + "thriftless", + "thumbscrew", + "topaz", + "transcript", + "transgress", + "transplant", + "triphthong", + "twelfth", + "twelfths", + "unknown", + "unworthy", + "unzip", + "uptown", + "vaporize", + "vixen", + "vodka", + "voodoo", + "vortex", + "voyeurism", + "walkway", + "waltz", + "wave", + "wavy", + "waxy", + "wellspring", + "wheezy", + "whiskey", + "whizzing", + "whomever", + "wimpy", + "witchcraft", + "wizard", + "woozy", + "wristwatch", + "wyvern", + "xylophone", + "yachtsman", + "yippee", + "yoked", + "youthful", + "yummy", + "zephyr", + "zigzag", + "zigzagging", + "zilch", + "zipper", + "zodiac", + "zombie", +]
/home/runner/work/PythonProjects/PythonProjects/Password Generator/main.py#L1
import random -#Eazy Level - Order not randomised: -#e.g. 4 letter, 2 symbol, 2 number = JduE&!91 -#Hard Level - Order of characters randomised: -#e.g. 4 letter, 2 symbol, 2 number = g^2jk8&P +# Eazy Level - Order not randomised: +# e.g. 4 letter, 2 symbol, 2 number = JduE&!91 + + +# Hard Level - Order of characters randomised: +# e.g. 4 letter, 2 symbol, 2 number = g^2jk8&P def generate_password(nl, ns, nn, shuffle=True): - letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'] - numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] - symbols = ['!', '#', '$', '%', '&', '(', ')', '*', '+'] + letters = [ + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + ] + numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"] + symbols = ["!", "#", "$", "%", "&", "(", ")", "*", "+"] password = [] - + password += [random.choice(letters) for _ in range(nl)] password += [random.choice(symbols) for _ in range(ns)] password += [random.choice(numbers) for _ in range(nn)] if shuffle: random.shuffle(password) - return ''.join(password) + return "".join(password) + print("Welcome to the PyPassword Generator!") nl = int(input("How many letters would you like in your password?\n")) ns = int(input("How many symbols would you like?\n")) nn = int(input("How many numbers would you like?\n")) -shuffle_option = input("Do you want to shuffle the characters in the password? (yes/no): ").lower() -shuffle_password = shuffle_option == 'yes' +shuffle_option = input( + "Do you want to shuffle the characters in the password? (yes/no): " +).lower() +shuffle_password = shuffle_option == "yes" generated_password = generate_password(nl, ns, nn, shuffle_password) print("Your generated password is:", generated_password) -## By including the shuffle parameter, +## By including the shuffle parameter, # you give users the flexibility to choose whether they prioritize a completely random arrangement of characters for # increased security or if they prefer a specific structure for ease of memorization or other reasons
CurrencyConverter/main.py#L21
Line too long (89 > 79 characters) (E501)
/home/runner/work/PythonProjects/PythonProjects/PongGame/paddle.py#L1
from turtle import Turtle class Paddle(Turtle): - def __init__(self, x, y): super().__init__() self.shape("square") self.penup() self.goto(x=x, y=y)
CurrencyConverter/main.py#L27
Expected 2 blank lines after class or function definition, found 1 (E305)
CurrencyConverter/main.py#L32
Line too long (90 > 79 characters) (E501)
/home/runner/work/PythonProjects/PythonProjects/PongGame/scoreboard.py#L1
from turtle import Turtle class Scoreboard(Turtle): - def __init__(self): super().__init__() self.color("tomato") self.penup() self.hideturtle()
Guess-the-number-game/logo.py#L2
Line too long (116 > 79 characters) (E501)
/home/runner/work/PythonProjects/PythonProjects/PongGame/main.py#L45
while game_is_on: time.sleep(ball.move_speed) screen.update() ball.move() -# Detect collision with wall + # Detect collision with wall if ball.ycor() < -280 or ball.ycor() >= 280: ball.bounce_y() -# Detect collision with paddle - if ball.distance(r_paddle) < 50 and ball.xcor() > 320 or ball.distance(l_paddle) < 50 and ball.xcor() < -320: + # Detect collision with paddle + if ( + ball.distance(r_paddle) < 50 + and ball.xcor() > 320 + or ball.distance(l_paddle) < 50 + and ball.xcor() < -320 + ): ball.bounce_x() -# Detect when miss + # Detect when miss if ball.xcor() > 380: ball.reset_position() score.l_add() if ball.xcor() < -380: ball.reset_position()
Guess-the-number-game/logo.py#L3
Line too long (116 > 79 characters) (E501)
/home/runner/work/PythonProjects/PythonProjects/QR_Generator/main.py#L3
from io import BytesIO from base64 import b64encode app = Flask(__name__) + @app.route("/") def home(): - return render_template('index.html') + return render_template("index.html") [email protected]("/generate", methods=['POST']) + [email protected]("/generate", methods=["POST"]) def QR_generator(): data = request.form.get("link") img = qrcode.make(data) memory = BytesIO() img.save(memory) memory.seek(0) - base64_img = "data:image/png;base64," + b64encode(memory.getvalue()).decode('ascii') + base64_img = "data:image/png;base64," + b64encode(memory.getvalue()).decode("ascii") - return render_template('index.html', data=base64_img) + return render_template("index.html", data=base64_img) -if __name__ == '__main__': - app.run(host='0.0.0.0', port=8080, debug=True) + +if __name__ == "__main__": + app.run(host="0.0.0.0", port=8080, debug=True)
Guess-the-number-game/logo.py#L4
Invalid escape sequence '\_' (W605)
/home/runner/work/PythonProjects/PythonProjects/Quiz Game/question_model.py#L1
class Question: - def __init__(self, q_text, q_answer): self.text = q_text self.answer = q_answer
/home/runner/work/PythonProjects/PythonProjects/SnakeGame/food.py#L1
from turtle import Turtle import random class Food(Turtle): - def __init__(self): super().__init__() self.shape("circle") self.penup() self.shapesize(stretch_len=0.5, stretch_wid=0.5)
/home/runner/work/PythonProjects/PythonProjects/Quiz Game/quiz_brain.py#L1
class QuizBrain: - def __init__(self, q_list): self.question_number = 0 self.score = 0 self.question_list = q_list
/home/runner/work/PythonProjects/PythonProjects/Quiz Game/quiz_brain.py#L9
return self.question_number < len(self.question_list) def next_question(self): current_question = self.question_list[self.question_number] self.question_number += 1 - user_answer = input(f"Q.{self.question_number}: {current_question.text} (True/False): ") + user_answer = input( + f"Q.{self.question_number}: {current_question.text} (True/False): " + ) self.check_answer(user_answer, current_question.answer) def check_answer(self, user_answer, correct_answer): if user_answer.lower() == correct_answer.lower(): self.score += 1
/home/runner/work/PythonProjects/PythonProjects/SnakeGame/main.py#L28
if snake.head.distance(food) < 15: food.refresh() snake.extend() scoreboard.increase_score() - if snake.head.xcor() > 290 or snake.head.xcor() < -295 or snake.head.ycor() > 290 or snake.head.ycor() < -295: + if ( + snake.head.xcor() > 290 + or snake.head.xcor() < -295 + or snake.head.ycor() > 290 + or snake.head.ycor() < -295 + ): scoreboard.reset() snake.reset() # Detect if hitting itself for i in snake.segments[1:]: if snake.head.distance(i) < 10: scoreboard.reset() snake.reset() screen.exitonclick() - -
/home/runner/work/PythonProjects/PythonProjects/SnakeGame/scoreboard.py#L1
from turtle import Turtle + ALIGN = "center" FONT = ("Courier", 24, "bold") class Scoreboard(Turtle): - def __init__(self): super().__init__() self.score = 0 with open("data.txt") as data: self.high_score = int(data.read()) self.penup() self.color("white") self.goto(0, 270) - self.write(f"Score: {self.score}", move=False, align=ALIGN, font=FONT) + self.write(f"Score: {self.score}", move=False, align=ALIGN, font=FONT) self.hideturtle() def increase_score(self): self.score += 1 self.update_scoreboard() def update_scoreboard(self): self.clear() - self.write(f"Score: {self.score}, High Score: {self.high_score}", move=False, align="center", font=("Arial", 24, "bold")) + self.write( + f"Score: {self.score}, High Score: {self.high_score}", + move=False, + align="center", + font=("Arial", 24, "bold"), + ) # def game_over(self): # self.goto(0, 0) # self.color("blue") # self.write("GAME OVER!!", align="center", font=("Courier", 66, "bold"))
Guess-the-number-game/logo.py#L4
Invalid escape sequence '\ ' (W605)
/home/runner/work/PythonProjects/PythonProjects/Tic tae toe/game.py#L1
def print_board(board): for row in board: print(" | ".join(row)) print("-" * 5) + def check_winner(board, player): # Check rows, columns, and diagonals for a win for i in range(3): - if all(board[i][j] == player for j in range(3)) or all(board[j][i] == player for j in range(3)): + if all(board[i][j] == player for j in range(3)) or all( + board[j][i] == player for j in range(3) + ): return True - if all(board[i][i] == player for i in range(3)) or all(board[i][2 - i] == player for i in range(3)): + if all(board[i][i] == player for i in range(3)) or all( + board[i][2 - i] == player for i in range(3) + ): return True return False + def is_board_full(board): - return all(board[i][j] != ' ' for i in range(3) for j in range(3)) + return all(board[i][j] != " " for i in range(3) for j in range(3)) + def tic_tac_toe(): - board = [[' ' for _ in range(3)] for _ in range(3)] - current_player = 'X' + board = [[" " for _ in range(3)] for _ in range(3)] + current_player = "X" while True: print_board(board) # Get player move row = int(input("Enter row (0, 1, or 2): ")) col = int(input("Enter column (0, 1, or 2): ")) # Check if the chosen cell is empty - if board[row][col] == ' ': + if board[row][col] == " ": board[row][col] = current_player else: print("Cell already taken. Try again.") continue
Guess-the-number-game/logo.py#L4
Invalid escape sequence '\ ' (W605)
/home/runner/work/PythonProjects/PythonProjects/Tic tae toe/game.py#L44
print_board(board) print("It's a tie!") break # Switch to the other player - current_player = 'O' if current_player == 'X' else 'X' + current_player = "O" if current_player == "X" else "X" + if __name__ == "__main__": tic_tac_toe()
Guess-the-number-game/logo.py#L4
Line too long (115 > 79 characters) (E501)
/home/runner/work/PythonProjects/PythonProjects/SnakeGame/snake.py#L1
from turtle import Turtle + STARTING_POS = [(0, 0), (-20, 0), (-40, 0)] MOVE_DISTANCE = 20 UP = 90 DOWN = 270 RIGHT = 0
Guess-the-number-game/logo.py#L4
Invalid escape sequence '\_' (W605)
/home/runner/work/PythonProjects/PythonProjects/WebScraper/test_web_scraper.py#L1
import unittest import web_scraper + class Test_Web_Scraper(unittest.TestCase): def test_recursive_call(self): - unique_url = {"https://apple.com"} web_scraper.web_crawler(unique_url) -if __name__ == '__main__': +if __name__ == "__main__": unittest.main()
Guess-the-number-game/logo.py#L4
Invalid escape sequence '\ ' (W605)
/home/runner/work/PythonProjects/PythonProjects/WebScraper/web_scraper.py#L3
from bs4 import BeautifulSoup import os from urllib.parse import urljoin from pathlib import Path -'''empty list for to store urls''' +"""empty list for to store urls""" visited = set() + def web_crawler(unique_urls): - '''Large websites is hard to crawl and can take a lot of time - for educational purposes it limited to 3000 visited links''' - while(len(unique_urls) > len(visited) and len(unique_urls) < 3000): - - print(f'Unique links number {len(unique_urls)}') - print(f'Visited links numbers {len(visited)}') + """Large websites is hard to crawl and can take a lot of time + for educational purposes it limited to 3000 visited links""" + while len(unique_urls) > len(visited) and len(unique_urls) < 3000: + print(f"Unique links number {len(unique_urls)}") + print(f"Visited links numbers {len(visited)}") current_url = unique_urls.pop() - headers = {'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0'} + headers = { + "User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0" + } try: page = requests.get(current_url, headers=headers) soup = BeautifulSoup(page.content, "html.parser") save_page(page, soup) sleep(1) - '''Loop reads all urls on curreent page''' - for node in soup.find_all('a'): - '''Get href attribute with link to other pages''' - href= node.get('href') + """Loop reads all urls on curreent page""" + for node in soup.find_all("a"): + """Get href attribute with link to other pages""" + href = node.get("href") full_url = urljoin(current_url, href) if full_url not in visited and full_url not in unique_urls: unique_urls.add(full_url) else: visited.add(full_url) except Exception: pass + def save_page(page, soup): - '''Check if directory for saving scraped pages exist''' - storage_directory = os.path.expanduser('~/storage') + """Check if directory for saving scraped pages exist""" + storage_directory = os.path.expanduser("~/storage") if not os.path.exists(storage_directory): os.mkdir(storage_directory) - '''Save html pages to storage directory''' + """Save html pages to storage directory""" try: - home_dir = os.path.expanduser('~') + home_dir = os.path.expanduser("~") filename = f"html_{soup.find('title').text}.html" - filename = os.path.join(home_dir, 'storage' , filename) + filename = os.path.join(home_dir, "storage", filename) print(filename) - with open(filename, 'w') as f: + with open(filename, "w") as f: f.write(page.text) f.close() sleep(1) except Exception: pass -'''This application is demo web scraping application creeated which + +"""This application is demo web scraping application creeated which working in the way of webcrawler and using Beautiful soup to travel -through links and save html pages on user machine''' +through links and save html pages on user machine""" + + def main(): - base_url = input("Enter URL to start scraping web site: \n") - '''Create empty storage for non veseted unique links''' + """Create empty storage for non veseted unique links""" unique_urls = {base_url} web_crawler(unique_urls) + if __name__ == "__main__": - main() + main()
Guess-the-number-game/logo.py#L4
Invalid escape sequence '\_' (W605)
/home/runner/work/PythonProjects/PythonProjects/blackjack-final/art.py#L6
| \/ | / \ | | |_) | | (_| | (__| <| | (_| | (__| < `-----| \ / | |_.__/|_|\__,_|\___|_|\_\ |\__,_|\___|_|\_\\ | \/ K| _/ | `------' |__/ """ - - - -
/home/runner/work/PythonProjects/PythonProjects/blackjack-final/main.py#L1
import random from replit import clear from art import logo + def deal_card(): - """Returns a random card from the deck.""" - cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10] - card = random.choice(cards) - return card + """Returns a random card from the deck.""" + cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10] + card = random.choice(cards) + return card def calculate_score(cards): - """Take a list of cards and return the score calculated from the cards""" + """Take a list of cards and return the score calculated from the cards""" - - if sum(cards) == 21 and len(cards) == 2: - return 0 - - if 11 in cards and sum(cards) > 21: - cards.remove(11) - cards.append(1) - return sum(cards) + if sum(cards) == 21 and len(cards) == 2: + return 0 + + if 11 in cards and sum(cards) > 21: + cards.remove(11) + cards.append(1) + return sum(cards) + def compare(user_score, computer_score): + if user_score > 21 and computer_score > 21: + return "You went over. You lose 😤" - if user_score > 21 and computer_score > 21: - return "You went over. You lose 😤" + if user_score == computer_score: + return "Draw 🙃" + elif computer_score == 0: + return "Lose, opponent has Blackjack 😱" + elif user_score == 0: + return "Win with a Blackjack 😎" + elif user_score > 21: + return "You went over. You lose 😭" + elif computer_score > 21: + return "Opponent went over. You win 😁" + elif user_score > computer_score: + return "You win 😃" + else: + return "You lose 😤" - if user_score == computer_score: - return "Draw 🙃" - elif computer_score == 0: - return "Lose, opponent has Blackjack 😱" - elif user_score == 0: - return "Win with a Blackjack 😎" - elif user_score > 21: - return "You went over. You lose 😭" - elif computer_score > 21: - return "Opponent went over. You win 😁" - elif user_score > computer_score: - return "You win 😃" - else: - return "You lose 😤" +def play_game(): + print(logo) -def play_game(): + user_cards = [] + computer_cards = [] + is_game_over = False - print(logo) + for _ in range(2): + user_cards.append(deal_card()) + computer_cards.append(deal_card()) - user_cards = [] - computer_cards = [] - is_game_over = False + while not is_game_over: + user_score = calculate_score(user_cards) + computer_score = calculate_score(computer_cards) + print(f" Your cards: {user_cards}, current score: {user_score}") + print(f" Computer's first card: {computer_cards[0]}") - for _ in range(2): - user_cards.append(deal_card()) - computer_cards.append(deal_card()) + if user_score == 0 or computer_score == 0 or user_score > 21: + is_game_over = True + else: + user_should_deal = input("Type 'y' to get another card, type 'n' to pass: ") + if user_should_deal == "y": + user_cards.append(deal_card()) + else: + is_game_over = True - + while computer_score != 0 and computer_score < 17: + computer_cards.append(deal_card()) + computer_score = calculate_score(computer_cards) - while not is_game_over: - user_score = calculate_score(user_cards) - computer_score = calculate_score(computer_cards) - print(f" Your cards: {user_cards}, current score: {user_score}") - print(f" Computer's first card: {computer_cards[0]}") + print(f" Your final hand: {user_cards}, final score: {user_score}") + print(f" Computer's final hand: {computer_cards}, final score: {computer_score}") + print(compare(user_score, computer_score)) - if user_score == 0 or computer_score == 0 or user_score > 21: - is_game_over = True - else: - user_should_deal = input("Type 'y' to get another card, type 'n' to pass: ") - if user_should_deal == "y": - user_cards.append(deal_card()) - else: - is_game_over = True - - while computer_score != 0 and computer_score < 17: - computer_cards.append(deal_card()) - computer_score = calculate_score(computer_cards) - - print(f" Your final hand: {user_cards}, final score: {user_score}") - print(f" Computer's final hand: {computer_cards}, final score: {computer_score}") - print(compare(user_score, computer_score)) while input("Do you want to play a game of Blackjack? Type 'y' or 'n': ") == "y": - clear() - play_game() + clear() + play_game()
Guess-the-number-game/logo.py#L4
Trailing whitespace (W291)
/home/runner/work/PythonProjects/PythonProjects/caesar-cypher-code/art.py#L1
-logo = """ +logo = ( + """ ,adPPYba, ,adPPYYba, ,adPPYba, ,adPPYba, ,adPPYYba, 8b,dPPYba, a8" "" "" `Y8 a8P_____88 I8[ "" "" `Y8 88P' "Y8 -8b ,adPPPPP88 8PP""""""" `"Y8ba, ,adPPPPP88 88 +8b ,adPPPPP88 8PP""" + """" `"Y8ba, ,adPPPPP88 88 "8a, ,aa 88, ,88 "8b, ,aa aa ]8I 88, ,88 88 `"Ybbd8"' `"8bbdP"Y8 `"Ybbd8"' `"YbbdP"' `"8bbdP"Y8 88 88 88 "" 88 88 ,adPPYba, 88 8b,dPPYba, 88,dPPYba, ,adPPYba, 8b,dPPYba, a8" "" 88 88P' "8a 88P' "8a a8P_____88 88P' "Y8 -8b 88 88 d8 88 88 8PP""""""" 88 +8b 88 88 d8 88 88 8PP""" + """" 88 "8a, ,aa 88 88b, ,a8" 88 88 "8b, ,aa 88 `"Ybbd8"' 88 88`YbbdP"' 88 88 `"Ybbd8"' 88 88 88 -""" +""" +)
Guess-the-number-game/logo.py#L5
Line too long (114 > 79 characters) (E501)
/home/runner/work/PythonProjects/PythonProjects/Quiz Game/data.py#L1
question_data = [ - {"category": "Science & Nature", "type": "boolean", "difficulty": "medium", - "question": "The Doppler effect applies to light.", "correct_answer": "True", - "incorrect_answers": ["False"]}, - {"category": "History", "type": "boolean", "difficulty": "easy", - "question": "The Cold War ended with Joseph Stalin&#039;s death.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Science: Computers", "type": "boolean", "difficulty": "medium", - "question": "FLAC stands for &quot;Free Lossless Audio Condenser&quot;&#039;", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Video Games", "type": "boolean", "difficulty": "easy", - "question": "The Indie Game Development Studio Cing, developers of Hotel Dusk and Last Window, went bankrupt on March 1st, 2010.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Geography", "type": "boolean", "difficulty": "easy", - "question": "A group of islands is called an &#039;archipelago&#039;.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "General Knowledge", "type": "boolean", "difficulty": "medium", - "question": "The US emergency hotline is 911 because of the September 11th terrorist attacks.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Geography", "type": "boolean", "difficulty": "medium", - "question": "There are no roads in\/out of Juneau, Alaska.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Entertainment: Musicals & Theatres", "type": "boolean", - "difficulty": "easy", - "question": "In the play Oedipus Rex, Oedipus kills his father due to jealousy in loving his mother.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "History", "type": "boolean", "difficulty": "easy", - "question": "The Spitfire originated from a racing plane.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Animals", "type": "boolean", "difficulty": "easy", - "question": "Kangaroos keep food in their pouches next to their children.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "History", "type": "boolean", "difficulty": "medium", - "question": "&quot;I disapprove of what you say, but I will defend to the death your right to say it&quot; is a quote from French philosopher Voltaire.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Science: Mathematics", "type": "boolean", "difficulty": "easy", - "question": "A universal set, or a set that contains all sets, exists.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Video Games", "type": "boolean", - "difficulty": "medium", - "question": "The Ace Attorney trilogy was suppose to end with &quot;Phoenix Wright: Ace Attorney &minus; Trials and Tribulations&quot; as its final game.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Vehicles", "type": "boolean", "difficulty": "medium", - "question": "The Chevrolet Corvette has always been made exclusively with V8 engines only.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Video Games", "type": "boolean", "difficulty": "easy", - "question": "Pac-Man was invented by the designer Toru Iwatani while he was eating pizza.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Entertainment: Japanese Anime & Manga", "type": "boolean", - "difficulty": "easy", - "question": "In Kill La Kill, the weapon of the main protagonist is a katana. ", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "General Knowledge", "type": "boolean", "difficulty": "medium", - "question": "Cucumbers are usually more than 90% water.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Politics", "type": "boolean", "difficulty": "easy", - "question": "Denmark has a monarch.", "correct_answer": "True", - "incorrect_answers": ["False"]}, - {"category": "Politics", "type": "boolean", "difficulty": "easy", - "question": "Despite being seperated into multiple countries, The Scandinavian countries are unified by all having the same monarch.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "General Knowledge", "type": "boolean", "difficulty": "easy", - "question": "The Sun rises from the North.", "correct_answer": "False", - "incorrect_answers": ["True"]}, - {"category": "Science & Nature", "type": "boolean", "difficulty": "medium", - "question": "Scientists accidentally killed the once known world&#039;s oldest living creature, a mollusc, known to be aged as 507 years old.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Entertainment: Japanese Anime & Manga", "type": "boolean", - "difficulty": "easy", "question": "No Game No Life first aired in 2014.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Geography", "type": "boolean", "difficulty": "easy", - "question": "Toronto is the capital city of the North American country of Canada.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Television", "type": "boolean", - "difficulty": "medium", - "question": "In the TV series Red Dwarf, Kryten&#039;s full name is Kryten 2X4B-523P.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Geography", "type": "boolean", "difficulty": "medium", - "question": "The capital of the US State Ohio is the city of Chillicothe.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Film", "type": "boolean", "difficulty": "medium", - "question": "Sean Connery wasn&#039;t in &quot;Indiana Jones and the Kingdom of the Crystal Skull&quot; because he found retirement too enjoyable.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Science: Computers", "type": "boolean", "difficulty": "easy", - "question": "The NVidia GTX 1080 gets its name because it can only render at a 1920x1080 screen resolution.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Science & Nature", "type": "boolean", "difficulty": "medium", - "question": "In the periodic table, Potassium&#039;s symbol is the letter K.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "History", "type": "boolean", "difficulty": "medium", - "question": "Oxford University is older than the Aztec Empire. ", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Entertainment: Music", "type": "boolean", "difficulty": "easy", - "question": "Daft Punk originated in France.", "correct_answer": "True", - "incorrect_answers": ["False"]}, - {"category": "Entertainment: Video Games", "type": "boolean", "difficulty": "easy", - "question": "In &quot;Undertale&quot;, the main character of the game is Sans.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Video Games", "type": "boolean", "difficulty": "easy", - "question": "In RuneScape, one must complete the &quot;Dragon Slayer&quot; quest before equipping Rune Platelegs.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Video Games", "type": "boolean", "difficulty": "easy", - "question": "Watch_Dogs 2 is a prequel.", "correct_answer": "False", - "incorrect_answers": ["True"]}, - {"category": "Entertainment: Video Games", "type": "boolean", "difficulty": "easy", - "question": "In Heroes of the Storm, the Cursed Hollow map gimmick requires players to kill the undead to curse the enemy team.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Television", "type": "boolean", "difficulty": "easy", - "question": "Klingons express emotion in art through opera and poetry.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Entertainment: Video Games", "type": "boolean", - "difficulty": "medium", - "question": "In Portal, the Companion Cube&#039;s ARE sentient.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Entertainment: Video Games", "type": "boolean", - "difficulty": "medium", - "question": "In &quot;Super Mario World&quot;, the rhino mini-boss, Reznor, is named after the lead singer of the band &quot;Nine Inch Nails&quot;.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Celebrities", "type": "boolean", "difficulty": "hard", - "question": "Lady Gaga&#039;s real name is Stefani Joanne Angelina Germanotta.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Entertainment: Cartoon & Animations", "type": "boolean", - "difficulty": "easy", - "question": "Waylon Smithers from &quot;The Simpsons&quot; was originally black when he first appeared in the series.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Entertainment: Video Games", "type": "boolean", - "difficulty": "medium", - "question": "In &quot;Starbound&quot;, the track played by the Decorated Music Box is named &quot;Atlas&quot;.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Entertainment: Video Games", "type": "boolean", - "difficulty": "medium", - "question": "In &quot;League of Legends&quot;, there exists four different types of Dragon.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Music", "type": "boolean", "difficulty": "medium", - "question": "Musical artist, Future, collaborated with Kendrick Lamar for the song: &quot;Mask Off&quot;.", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Mythology", "type": "boolean", "difficulty": "easy", - "question": "A wyvern is the same as a dragon.", "correct_answer": "False", - "incorrect_answers": ["True"]}, - {"category": "Science & Nature", "type": "boolean", "difficulty": "easy", - "question": "Water always boils at 100&deg;C, 212&deg;F, 373.15K, no matter where you are.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Cartoon & Animations", "type": "boolean", - "difficulty": "medium", - "question": "Blue Danube was one of the musical pieces featured in Disney&#039;s 1940&#039;s film Fantasia.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "General Knowledge", "type": "boolean", "difficulty": "medium", - "question": "Popcorn was invented in 1871 by Frederick W. Rueckheim in the USA where he sold the snack on the streets of Chicago.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Music", "type": "boolean", "difficulty": "medium", - "question": "Metallica collaborated with Rowan Atkinson&#039;s Mr Bean on a 1992 comic relief single.", - "correct_answer": "False", "incorrect_answers": ["True"]}, - {"category": "Entertainment: Video Games", "type": "boolean", "difficulty": "hard", - "question": "The video game &quot;Fuel&quot; has an open world that is 5,560 square miles?", - "correct_answer": "True", "incorrect_answers": ["False"]}, - {"category": "Animals", "type": "boolean", "difficulty": "easy", - "question": "Rabbits are carnivores.", "correct_answer": "False", - "incorrect_answers": ["True"]}, - {"category": "Entertainment: Video Games", "type": "boolean", - "difficulty": "medium", - "question": "In &quot;Resident Evil&quot;, only Chris has access to the grenade launcher.", - "correct_answer": "False", "incorrect_answers": ["True"]} + { + "category": "Science & Nature", + "type": "boolean", + "difficulty": "medium", + "question": "The Doppler effect applies to light.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "History", + "type": "boolean", + "difficulty": "easy", + "question": "The Cold War ended with Joseph Stalin&#039;s death.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Science: Computers", + "type": "boolean", + "difficulty": "medium", + "question": "FLAC stands for &quot;Free Lossless Audio Condenser&quot;&#039;", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "easy", + "question": "The Indie Game Development Studio Cing, developers of Hotel Dusk and Last Window, went bankrupt on March 1st, 2010.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Geography", + "type": "boolean", + "difficulty": "easy", + "question": "A group of islands is called an &#039;archipelago&#039;.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "General Knowledge", + "type": "boolean", + "difficulty": "medium", + "question": "The US emergency hotline is 911 because of the September 11th terrorist attacks.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Geography", + "type": "boolean", + "difficulty": "medium", + "question": "There are no roads in\/out of Juneau, Alaska.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Entertainment: Musicals & Theatres", + "type": "boolean", + "difficulty": "easy", + "question": "In the play Oedipus Rex, Oedipus kills his father due to jealousy in loving his mother.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "History", + "type": "boolean", + "difficulty": "easy", + "question": "The Spitfire originated from a racing plane.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Animals", + "type": "boolean", + "difficulty": "easy", + "question": "Kangaroos keep food in their pouches next to their children.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "History", + "type": "boolean", + "difficulty": "medium", + "question": "&quot;I disapprove of what you say, but I will defend to the death your right to say it&quot; is a quote from French philosopher Voltaire.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Science: Mathematics", + "type": "boolean", + "difficulty": "easy", + "question": "A universal set, or a set that contains all sets, exists.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "medium", + "question": "The Ace Attorney trilogy was suppose to end with &quot;Phoenix Wright: Ace Attorney &minus; Trials and Tribulations&quot; as its final game.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Vehicles", + "type": "boolean", + "difficulty": "medium", + "question": "The Chevrolet Corvette has always been made exclusively with V8 engines only.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "easy", + "question": "Pac-Man was invented by the designer Toru Iwatani while he was eating pizza.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Entertainment: Japanese Anime & Manga", + "type": "boolean", + "difficulty": "easy", + "question": "In Kill La Kill, the weapon of the main protagonist is a katana. ", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "General Knowledge", + "type": "boolean", + "difficulty": "medium", + "question": "Cucumbers are usually more than 90% water.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Politics", + "type": "boolean", + "difficulty": "easy", + "question": "Denmark has a monarch.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Politics", + "type": "boolean", + "difficulty": "easy", + "question": "Despite being seperated into multiple countries, The Scandinavian countries are unified by all having the same monarch.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "General Knowledge", + "type": "boolean", + "difficulty": "easy", + "question": "The Sun rises from the North.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Science & Nature", + "type": "boolean", + "difficulty": "medium", + "question": "Scientists accidentally killed the once known world&#039;s oldest living creature, a mollusc, known to be aged as 507 years old.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Entertainment: Japanese Anime & Manga", + "type": "boolean", + "difficulty": "easy", + "question": "No Game No Life first aired in 2014.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Geography", + "type": "boolean", + "difficulty": "easy", + "question": "Toronto is the capital city of the North American country of Canada.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Television", + "type": "boolean", + "difficulty": "medium", + "question": "In the TV series Red Dwarf, Kryten&#039;s full name is Kryten 2X4B-523P.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Geography", + "type": "boolean", + "difficulty": "medium", + "question": "The capital of the US State Ohio is the city of Chillicothe.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Film", + "type": "boolean", + "difficulty": "medium", + "question": "Sean Connery wasn&#039;t in &quot;Indiana Jones and the Kingdom of the Crystal Skull&quot; because he found retirement too enjoyable.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Science: Computers", + "type": "boolean", + "difficulty": "easy", + "question": "The NVidia GTX 1080 gets its name because it can only render at a 1920x1080 screen resolution.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Science & Nature", + "type": "boolean", + "difficulty": "medium", + "question": "In the periodic table, Potassium&#039;s symbol is the letter K.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "History", + "type": "boolean", + "difficulty": "medium", + "question": "Oxford University is older than the Aztec Empire. ", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Entertainment: Music", + "type": "boolean", + "difficulty": "easy", + "question": "Daft Punk originated in France.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "easy", + "question": "In &quot;Undertale&quot;, the main character of the game is Sans.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "easy", + "question": "In RuneScape, one must complete the &quot;Dragon Slayer&quot; quest before equipping Rune Platelegs.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "easy", + "question": "Watch_Dogs 2 is a prequel.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "easy", + "question": "In Heroes of the Storm, the Cursed Hollow map gimmick requires players to kill the undead to curse the enemy team.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Television", + "type": "boolean", + "difficulty": "easy", + "question": "Klingons express emotion in art through opera and poetry.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "medium", + "question": "In Portal, the Companion Cube&#039;s ARE sentient.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "medium", + "question": "In &quot;Super Mario World&quot;, the rhino mini-boss, Reznor, is named after the lead singer of the band &quot;Nine Inch Nails&quot;.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Celebrities", + "type": "boolean", + "difficulty": "hard", + "question": "Lady Gaga&#039;s real name is Stefani Joanne Angelina Germanotta.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Entertainment: Cartoon & Animations", + "type": "boolean", + "difficulty": "easy", + "question": "Waylon Smithers from &quot;The Simpsons&quot; was originally black when he first appeared in the series.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "medium", + "question": "In &quot;Starbound&quot;, the track played by the Decorated Music Box is named &quot;Atlas&quot;.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "medium", + "question": "In &quot;League of Legends&quot;, there exists four different types of Dragon.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Music", + "type": "boolean", + "difficulty": "medium", + "question": "Musical artist, Future, collaborated with Kendrick Lamar for the song: &quot;Mask Off&quot;.", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Mythology", + "type": "boolean", + "difficulty": "easy", + "question": "A wyvern is the same as a dragon.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Science & Nature", + "type": "boolean", + "difficulty": "easy", + "question": "Water always boils at 100&deg;C, 212&deg;F, 373.15K, no matter where you are.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Cartoon & Animations", + "type": "boolean", + "difficulty": "medium", + "question": "Blue Danube was one of the musical pieces featured in Disney&#039;s 1940&#039;s film Fantasia.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "General Knowledge", + "type": "boolean", + "difficulty": "medium", + "question": "Popcorn was invented in 1871 by Frederick W. Rueckheim in the USA where he sold the snack on the streets of Chicago.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Music", + "type": "boolean", + "difficulty": "medium", + "question": "Metallica collaborated with Rowan Atkinson&#039;s Mr Bean on a 1992 comic relief single.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "hard", + "question": "The video game &quot;Fuel&quot; has an open world that is 5,560 square miles?", + "correct_answer": "True", + "incorrect_answers": ["False"], + }, + { + "category": "Animals", + "type": "boolean", + "difficulty": "easy", + "question": "Rabbits are carnivores.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, + { + "category": "Entertainment: Video Games", + "type": "boolean", + "difficulty": "medium", + "question": "In &quot;Resident Evil&quot;, only Chris has access to the grenade launcher.", + "correct_answer": "False", + "incorrect_answers": ["True"], + }, ]
/home/runner/work/PythonProjects/PythonProjects/Tic-Tac-Toe Game/game.py#L1
import tkinter as tk from tkinter import * from tkinter import ttk -root=Tk() +root = Tk() root.title("Tic-Tac-Toe") -j=0;b1=0;b2=0;b3=0;b4=0;b5=0;b6=0;b7=0;b8=0;b9=0;l=0 +j = 0 +b1 = 0 +b2 = 0 +b3 = 0 +b4 = 0 +b5 = 0 +b6 = 0 +b7 = 0 +b8 = 0 +b9 = 0 +l = 0 + def click(num): - - global b1,b2,b3,b4,b5,b6,b7,b8,b9,j,l - i=j%2 - - if i==0: - if num==1 and b1==0: + global b1, b2, b3, b4, b5, b6, b7, b8, b9, j, l + i = j % 2 + + if i == 0: + if num == 1 and b1 == 0: btn_1.config(text="X") - b1=1 - j+=1 - - elif num==2 and b2==0: + b1 = 1 + j += 1 + + elif num == 2 and b2 == 0: btn_2.config(text="X") - b2=1 - j+=1 - - elif num==3 and b3==0: + b2 = 1 + j += 1 + + elif num == 3 and b3 == 0: btn_3.config(text="X") - b3=1 - j+=1 - - elif num==4 and b4==0: + b3 = 1 + j += 1 + + elif num == 4 and b4 == 0: btn_4.config(text="X") - b4=1 - j+=1 - - elif num==5 and b5==0: + b4 = 1 + j += 1 + + elif num == 5 and b5 == 0: btn_5.config(text="X") - b5=1 - j+=1 - - elif num==6 and b6==0: + b5 = 1 + j += 1 + + elif num == 6 and b6 == 0: btn_6.config(text="X") - b6=1 - j+=1 - - elif num==7 and b7==0: + b6 = 1 + j += 1 + + elif num == 7 and b7 == 0: btn_7.config(text="X") - b7=1 - j+=1 - - elif num==8 and b8==0: + b7 = 1 + j += 1 + + elif num == 8 and b8 == 0: btn_8.config(text="X") - b8=1 - j+=1 - - elif num==9 and b9==0: + b8 = 1 + j += 1 + + elif num == 9 and b9 == 0: btn_9.config(text="X") - b9=1 - j+=1 - - if (b1==b2==b3==1) or (b1==b4==b7==1) or (b2==b5==b8==1) or \ - (b3==b6==b9==1) or (b4==b5==b6==1) or (b7==b8==b9==1) or \ - (b1==b5==b9==1) or (b3==b5==b7==1): - l=ttk.Label(root,text="O won!",width=10) - l.grid(row=5,column=2) - - elif i==1: - - if num==1 and b1==0: + b9 = 1 + j += 1 + + if ( + (b1 == b2 == b3 == 1) + or (b1 == b4 == b7 == 1) + or (b2 == b5 == b8 == 1) + or (b3 == b6 == b9 == 1) + or (b4 == b5 == b6 == 1) + or (b7 == b8 == b9 == 1) + or (b1 == b5 == b9 == 1) + or (b3 == b5 == b7 == 1) + ): + l = ttk.Label(root, text="O won!", width=10) + l.grid(row=5, column=2) + + elif i == 1: + if num == 1 and b1 == 0: btn_1.config(text="O") - b1=2 - j+=1 - - elif num==2 and b2==0: + b1 = 2 + j += 1 + + elif num == 2 and b2 == 0: btn_2.config(text="O") - b2=2 - j+=1 - - elif num==3 and b3==0: + b2 = 2 + j += 1 + + elif num == 3 and b3 == 0: btn_3.config(text="O") - b3=2 - j+=1 - - elif num==4 and b4==0: + b3 = 2 + j += 1 + + elif num == 4 and b4 == 0: btn_4.config(text="O") - b4=2 - j+=1 - - elif num==5 and b5==0: + b4 = 2 + j += 1 + + elif num == 5 and b5 == 0: btn_5.config(text="O") - b5=2 - j+=1 - - elif num==6 and b6==0: + b5 = 2 + j += 1 + + elif num == 6 and b6 == 0: btn_6.config(text="O") - b6=2 - j+=1 - - elif num==7 and b7==0: + b6 = 2 + j += 1 + + elif num == 7 and b7 == 0: btn_7.config(text="O") - b7=2 - j+=1 - - elif num==8 and b8==0: + b7 = 2 + j += 1 + + elif num == 8 and b8 == 0: btn_8.config(text="O") - b8=2 - j+=1 - - elif num==9 and b9==0: + b8 = 2 + j += 1 + + elif num == 9 and b9 == 0: btn_9.config(text="O") - b9=2 - j+=1 - - if (b1==b2==b3==2) or (b1==b4==b7==2) or (b2==b5==b8==2) or \ - (b3==b6==b9==2) or (b4==b5==b6==2) or (b7==b8==b9==2) or \ - (b1==b5==b9==2) or (b3==b5==b7==2) or (b3==b5==b7==2): - l=ttk.Label(root,text="O won!",width=10) - l.grid(row=5,column=2) - + b9 = 2 + j += 1 + + if ( + (b1 == b2 == b3 == 2) + or (b1 == b4 == b7 == 2) + or (b2 == b5 == b8 == 2) + or (b3 == b6 == b9 == 2) + or (b4 == b5 == b6 == 2) + or (b7 == b8 == b9 == 2) + or (b1 == b5 == b9 == 2) + or (b3 == b5 == b7 == 2) + or (b3 == b5 == b7 == 2) + ): + l = ttk.Label(root, text="O won!", width=10) + l.grid(row=5, column=2) + + def reset(): - - global b1,b2,b3,b4,b5,b6,b7,b8,b9,j - b1=0;b2=0;b3=0;b4=0;b5=0;b6=0;b7=0;b8=0;b9=0;j=0 + global b1, b2, b3, b4, b5, b6, b7, b8, b9, j + b1 = 0 + b2 = 0 + b3 = 0 + b4 = 0 + b5 = 0 + b6 = 0 + b7 = 0 + b8 = 0 + b9 = 0 + j = 0 btn_1.config(text=" ") btn_2.config(text=" ") btn_3.config(text=" ") btn_4.config(text=" ") btn_5.config(text=" ")
Guess-the-number-game/logo.py#L5
Trailing whitespace (W291)
/home/runner/work/PythonProjects/PythonProjects/Tic-Tac-Toe Game/game.py#L130
btn_7.config(text=" ") btn_8.config(text=" ") btn_9.config(text=" ") l.config(text=" ") -btn_1=ttk.Button(root,text=" ",padding=20,command= lambda: click(1)) -btn_1.grid(row=1,column=1) -btn_2=ttk.Button(root,text=" ",padding=20,command= lambda: click(2)) -btn_2.grid(row=1,column=2) +btn_1 = ttk.Button(root, text=" ", padding=20, command=lambda: click(1)) +btn_1.grid(row=1, column=1) -btn_3=ttk.Button(root,text=" ",padding=20,command= lambda: click(3)) -btn_3.grid(row=1,column=3) +btn_2 = ttk.Button(root, text=" ", padding=20, command=lambda: click(2)) +btn_2.grid(row=1, column=2) -btn_4=ttk.Button(root,text=" ",padding=20,command= lambda: click(4)) -btn_4.grid(row=2,column=1) +btn_3 = ttk.Button(root, text=" ", padding=20, command=lambda: click(3)) +btn_3.grid(row=1, column=3) -btn_5=ttk.Button(root,text=" ",padding=20,command= lambda: click(5)) -btn_5.grid(row=2,column=2) +btn_4 = ttk.Button(root, text=" ", padding=20, command=lambda: click(4)) +btn_4.grid(row=2, column=1) -btn_6=ttk.Button(root,text=" ",padding=20,command= lambda: click(6)) -btn_6.grid(row=2,column=3) +btn_5 = ttk.Button(root, text=" ", padding=20, command=lambda: click(5)) +btn_5.grid(row=2, column=2) -btn_7=ttk.Button(root,text=" ",padding=20,command= lambda: click(7)) -btn_7.grid(row=3,column=1) +btn_6 = ttk.Button(root, text=" ", padding=20, command=lambda: click(6)) +btn_6.grid(row=2, column=3) -btn_8=ttk.Button(root,text=" ",padding=20,command= lambda: click(8)) -btn_8.grid(row=3,column=2) +btn_7 = ttk.Button(root, text=" ", padding=20, command=lambda: click(7)) +btn_7.grid(row=3, column=1) -btn_9=ttk.Button(root,text=" ",padding=20,command= lambda: click(9)) -btn_9.grid(row=3,column=3) +btn_8 = ttk.Button(root, text=" ", padding=20, command=lambda: click(8)) +btn_8.grid(row=3, column=2) -reset_btn=ttk.Button(root,text="Reset",padding=20,command=reset) -reset_btn.grid(row=4,column=2) +btn_9 = ttk.Button(root, text=" ", padding=20, command=lambda: click(9)) +btn_9.grid(row=3, column=3) -root.mainloop() +reset_btn = ttk.Button(root, text="Reset", padding=20, command=reset) +reset_btn.grid(row=4, column=2) + +root.mainloop()
Guess-the-number-game/logo.py#L6
Invalid escape sequence '\_' (W605)
Guess-the-number-game/logo.py#L6
Invalid escape sequence '\_' (W605)
/home/runner/work/PythonProjects/PythonProjects/caesar-cypher-code/main.py#L1
from art import logo + print(logo) -alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] +alphabet = [ + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", +] + def caesar(txt, shft, dirc): - new_word = "" - n=0 - for i in txt: - if i not in alphabet: - new_word += i + "" - continue - if i == ' ': - new_word += ' ' + "" - continue - n = alphabet.index(i) - if dirc == "encode": - n+= shft - while n>=26: - n=n-26 - if dirc == "decode": - n-= shft - while n<0: - n=n+26 - new_word += alphabet[n] + "" - print(f"The {dirc}d text is :\n",new_word.capitalize()) + new_word = "" + n = 0 + for i in txt: + if i not in alphabet: + new_word += i + "" + continue + if i == " ": + new_word += " " + "" + continue + n = alphabet.index(i) + if dirc == "encode": + n += shft + while n >= 26: + n = n - 26 + if dirc == "decode": + n -= shft + while n < 0: + n = n + 26 + new_word += alphabet[n] + "" + print(f"The {dirc}d text is :\n", new_word.capitalize()) + while True: - direction = input("Type 'encode' to encrypt, type 'decode' to decrypt:\n") - text = input("Type your message:\n").lower() - shift = int(input("Type the shift number:\n")) + direction = input("Type 'encode' to encrypt, type 'decode' to decrypt:\n") + text = input("Type your message:\n").lower() + shift = int(input("Type the shift number:\n")) - caesar(text, shift, direction) + caesar(text, shift, direction) - choice = input("Do you want to continue the cipher program?\n").lower() - if choice == "no": - print("Goodbye😃") - break - + choice = input("Do you want to continue the cipher program?\n").lower() + if choice == "no": + print("Goodbye😃") + break
Guess-the-number-game/logo.py#L6
Invalid escape sequence '\_' (W605)
/home/runner/work/PythonProjects/PythonProjects/turtle crossing game/car_manager.py#L1
from turtle import Turtle import random + COLORS = ["red", "orange", "yellow", "green", "blue", "purple"] STARTING_MOVE_DISTANCE = 5 MOVE_INCREMENT = 5 class CarManager(Turtle): - def __init__(self): super().__init__() self.hideturtle() self.all_cars = [] self.car_speed = STARTING_MOVE_DISTANCE
Guess-the-number-game/logo.py#L6
Invalid escape sequence '\_' (W605)
/home/runner/work/PythonProjects/PythonProjects/rock-paper-scissors/main.py#L1
import random -rock = ''' +rock = """ _______ ---' ____) (_____) (_____) (____) ---.__(___) -''' +""" -paper = ''' +paper = """ _______ ---' ____)____ ______) _______) _______) ---.__________) -''' +""" -scissors = ''' +scissors = """ _______ ---' ____)____ ______) __________) (____) ---.__(___) -''' +""" l = [rock, paper, scissors] print("What do you choose? Type 0 for Rock, 1 for Paper or 2 for Scissors.") n = int(input()) -r = random.randint(0,2) -if n>2: print("Invalid input") +r = random.randint(0, 2) +if n > 2: + print("Invalid input") c = "y" -while c == "y" or c=="Y": - print(f'\nYou chose : \n {l[n]}\n') - print(f'Computer chose : \n {l[r]}\n') +while c == "y" or c == "Y": + print(f"\nYou chose : \n {l[n]}\n") + print(f"Computer chose : \n {l[r]}\n") if n == r: - print(" It's a Draw!! ") - elif n==0: - if r == 1: - print("You lose! :( ") - if r == 2: - print("You win! :) ") + print(" It's a Draw!! ") + elif n == 0: + if r == 1: + print("You lose! :( ") + if r == 2: + print("You win! :) ") - elif n==1: - if r == 2: - print("You lose! :( ") - if r == 0: - print("You win! :) ") + elif n == 1: + if r == 2: + print("You lose! :( ") + if r == 0: + print("You win! :) ") else: - if r == 0: - print("You lose! :(") - if r == 1: - print("You win! :)") + if r == 0: + print("You lose! :(") + if r == 1: + print("You win! :)") - print("\nDo you want to continue? Press y for continue else press n to discontinue: ") - c = (input()) - if(c!="y" and c!="Y"): break + print( + "\nDo you want to continue? Press y for continue else press n to discontinue: " + ) + c = input() + if c != "y" and c != "Y": + break print("Enter your choice again! Type 0 for Rock, 1 for Paper or 2 for Scissors") n = int(input()) - r = random.randint(0,2) + r = random.randint(0, 2) print("\nHope you enjoyed playing ;)\n") -
Guess-the-number-game/logo.py#L6
Invalid escape sequence '\_' (W605)
/home/runner/work/PythonProjects/PythonProjects/turtle crossing game/player.py#L4
MOVE_DISTANCE = 10 FINISH_LINE_Y = 280 class Player(Turtle): - def __init__(self): super().__init__() self.shape("turtle") # self.color("black") self.penup()
/home/runner/work/PythonProjects/PythonProjects/turtle crossing game/scoreboard.py#L1
from turtle import Turtle + FONT = ("Courier", 24, "normal") class Scoreboard(Turtle): - def __init__(self): super().__init__() self.level = 1 self.penup() self.hideturtle()
Guess-the-number-game/logo.py#L6
Line too long (113 > 79 characters) (E501)
/home/runner/work/PythonProjects/PythonProjects/turtle crossing game/scoreboard.py#L20
self.level += 1 self.update_scoreboard() def game_over(self): self.goto(0, 0) - self.write("GAME OVER!!", align="center", font=FONT) + self.write("GAME OVER!!", align="center", font=FONT)
Guess-the-number-game/logo.py#L6
Invalid escape sequence '\_' (W605)
Guess-the-number-game/logo.py#L6
Trailing whitespace (W291)
Guess-the-number-game/logo.py#L7
Blank line contains whitespace (W293)
Guess-the-number-game/logo.py#L8
No newline at end of file (W292)
Guess-the-number-game/logo.py#L8
Line too long (717 > 79 characters) (E501)
Guess-the-number-game/main.py#L7
Missing whitespace after ',' (E231)
Guess-the-number-game/main.py#L9
Block comment should start with '# ' (E265)
Guess-the-number-game/main.py#L12
Missing whitespace after keyword (E275)
Guess-the-number-game/main.py#L13
Indentation is not a multiple of 4 (E111)
Run linters
The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions/setup-python@v1, actions/setup-node@v1, wearerequired/lint-action@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/