Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: NameError: name 'score' is not defined - Help?
Post: RE: NameError: name 'score' is not defined - Help?

(Mar-06-2023, 02:37 PM)deanhystad Wrote: txt is only an extension. You use commas to separate name and score. You are writing a Comma Separated Values (csv) formatted text file. You can use json?...
MrKnd94 Homework 13 4,791 Mar-06-2023, 10:04 PM
  Question Thread: NameError: name 'score' is not defined - Help?
Post: RE: NameError: name 'score' is not defined - Help?

(Mar-05-2023, 09:17 PM)deanhystad Wrote: A json file is text, just like a CSV file is text. Both are just a special way to format text in a file. Probably a good idea to stick with a CSV format fi...
MrKnd94 Homework 13 4,791 Mar-06-2023, 12:23 AM
    Thread: NameError: name 'score' is not defined - Help?
Post: RE: NameError: name 'score' is not defined - Help?

(Mar-05-2023, 05:03 PM)deanhystad Wrote: You are writing a CSV file. You could use the CSV library or pandas to make it easier to read the file and convert into a dictionary. Easier still is savin...
MrKnd94 Homework 13 4,791 Mar-05-2023, 06:35 PM
    Thread: NameError: name 'score' is not defined - Help?
Post: RE: NameError: name 'score' is not defined - Help?

(Mar-03-2023, 10:31 PM)deanhystad Wrote: This function returns file-like object that you can use to read a file. It does not return the contents of a file. def load_scores(): with open(r'leader...
MrKnd94 Homework 13 4,791 Mar-05-2023, 04:45 PM
    Thread: NameError: name 'score' is not defined - Help?
Post: RE: NameError: name 'score' is not defined - Help?

Okay. New problem now. When we input this line of code in, it outputs: "<_io.TextIOWrapper name='leaderboard.txt' mode='r' encoding='cp1252'>". def load_scores(): with open(r'leaderboard.t...
MrKnd94 Homework 13 4,791 Mar-03-2023, 08:56 PM
  Exclamation Thread: NameError: name 'score' is not defined - Help?
Post: NameError: name 'score' is not defined - Help?

Hi, I'm going to be blunt, I'm here, helping out another student, and I need help. The error is in the title, and here's the code: def load_scores(score): name = input('What is your name?: ') ...
MrKnd94 Homework 13 4,791 Mar-03-2023, 12:48 PM
    Thread: If statement not working correctly?
Post: If statement not working correctly?

Hello. I'm sorry to bother you all, but I'm having trouble with the While loop, and the Quit function. I've tried it before, but I didn't get it to work, unfortunately. But I want it to work now. I'm...
MrKnd94 General Coding Help 2 865 Nov-15-2022, 04:58 PM
  Question Thread: Help with function - encryption - messages - NameError: name 'message' is not defined
Post: RE: Help with function - encryption - messages - N...

(Nov-09-2022, 06:36 PM)Yoriz Wrote: encryptHas a rogue a on line 7 The parameter message has its passed-in attribute overwritten on line 6 by an empty string When calling encrypt(message, shift) o...
MrKnd94 General Coding Help 4 3,025 Nov-11-2022, 07:42 PM
  Question Thread: Help with function - encryption - messages - NameError: name 'message' is not defined
Post: Help with function - encryption - messages - NameE...

Hello! I'm trying to encrypt messages using the Caesar Cipher. I've made a function for it. This is the code for it: def encrypt(message,shift): alphabet = 'abcdefghijklmnopqrstuvwxyz' # The alp...
MrKnd94 General Coding Help 4 3,025 Nov-09-2022, 05:28 PM
    Thread: Help with university work - reading and writing files
Post: Help with university work - reading and writing fi...

Hello, Me and a lot of my classmates are so confused in today's work. The answer sheet was published, but that didn't help us at all. Here's what they want: Write a Python function named extract...
MrKnd94 Homework 3 1,259 Nov-01-2022, 04:27 PM
    Thread: Code won't break While loop or go back to the input?
Post: Code won't break While loop or go back to the inpu...

Hello, I'm trying to input a list with a While loop, and then print the list when it is over 100 (the number), but it keeps going even though I put a break in. I've been trying and thinking about d...
MrKnd94 General Coding Help 2 1,037 Oct-26-2022, 09:36 AM
    Thread: Creating a change table - £0.01-£0.50?
Post: RE: Creating a change table - £0.01-£0.50?

(Oct-19-2022, 04:29 PM)perfringo Wrote: As I understand the objective one should iterate over values 0...99 and print row for every of them indicating from which coins and their quantities it can be...
MrKnd94 Homework 9 2,065 Oct-20-2022, 03:32 PM
    Thread: Creating a change table - £0.01-£0.50?
Post: Creating a change table - £0.01-£0.50?

Hello, I'm trying to complete my workbook for university, but I'm stuck on this question: Write a program that determines how many of each coin ( from 1p to 50p) a vending machine should dispense for...
MrKnd94 Homework 9 2,065 Oct-19-2022, 12:01 PM
    Thread: IndexError: Replacement index 2 out of range for positional args tuple - help?
Post: RE: IndexError: Replacement index 2 out of range f...

(Oct-14-2022, 09:53 PM)Yoriz Wrote: Adding a * will unpack the tuple returned from secret_formula print("We'd have {0} jelly beans, {2} jars, and {1} creates.".format(*secret_formula(start_point))) ...
MrKnd94 General Coding Help 2 6,697 Oct-14-2022, 09:57 PM
  Exclamation Thread: IndexError: Replacement index 2 out of range for positional args tuple - help?
Post: IndexError: Replacement index 2 out of range for p...

Hello. I've been trying for days to fix this error, but to no avail. This is the code: def secret_formula(started): jelly_beans = started * 500 jars = jelly_beans / 1000 crates = jars /...
MrKnd94 General Coding Help 2 6,697 Oct-14-2022, 09:46 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020