All Questions
18 questions
9
votes
2
answers
250
views
Blackjack game for assignment
I’m a first-year IT student, and I’ve completed a working Blackjack game in Python as part of an assignment. I’d love to get some feedback on my code structure, readability, and comments to improve my ...
2
votes
4
answers
507
views
Beginner Python program assignment: calculate the total number of bugs collected in a week using a while loop
Beginning of program assignment has a bug collector input the amount of bugs collected each day of the week then outputs the total number of bugs in a print statement. My professor has forbid us from ...
2
votes
2
answers
238
views
3 dimensional python battleship game
I have an assignment in a python course. We were instructed to make a 3D Battleships game for 2 players on the same computer. I've written a code that works, according to the assignment instructions, ...
3
votes
1
answer
1k
views
Generate and display usernames
Everything currently works exactly as requested by the instructor, I've included as much possible commented documentation as I can think of to make it easier for people to see what the required ...
12
votes
3
answers
2k
views
Implementing a rectangle class
First I've to indicate that this is my homework.
An example of a given input is:
s1 = {'p1': (x1, y1), 'p2': (x2, y2)}
where all names and coordinations are ...
3
votes
1
answer
153
views
Converting an input of space delimited integers to a list
tablou = input("Enter values delimited by space: ")
b = tablou.split()
t = [] # initial list with int() contents
for l in b:
r = int(l)
t.append(r)
I ...
2
votes
1
answer
125
views
Naive implementation of sort inplace
I had the following assignment for the Python 101 course I'm taking in my university.
...
17
votes
3
answers
7k
views
Python code that sorts books
I am currently a student just starting to learn python and I need help improving my code for a school assignment. I've already written the code for the program, just need suggestions on how to improve ...
7
votes
2
answers
2k
views
Simple Battleship written in Python
I would appreciate feedback on my first Battleship game written in Python for my intro to programming class.
Here is the code, the only thing in here is that I use a clear screen function from one of ...
7
votes
2
answers
18k
views
'Snakes and Ladders' game
I made this game of snakes and ladders for school, and it has to have:
Multiple players
Player Names
Random Dice roll
Snakes and ladders (obviously!)
Subroutines
It is currently 124 lines, ...
9
votes
3
answers
26k
views
Python class to implement a list with a size limit
I am currently working through a python course about objected oriented programming. I was given this first assignment to work on:
Create a simple class, MaxSizeList, that acts a little bit like a
...
8
votes
2
answers
6k
views
What's the optimal 'pythonic' way to make dot product of two lists of numbers?
I just filled in the first assignment on course which involves learning Python. The assignment was to make vector class which supports scalar multiplication through operator overloading.
The ...
1
vote
3
answers
38k
views
Writing numbers into a file [closed]
I'm taking my first ever CS class and I have an assignment due Friday. I just wanted someone to check my code.
Instructions:
Write a program that:
gets the name of a text file of numbers ...
3
votes
2
answers
1k
views
TCP client and server supporting six simple commands
For a class, I was given an assignment to code a simple TCP connection between a server and a client. Once the TCP handshake is done, the client sends inquiries to the server. It's a 2 second ...
2
votes
3
answers
38k
views
Removing punctuation and lowercasing a string
I am very fresh to python. As part of an assignment, I've written the following code to remove punctuation from a string and convert it to lowercase.
...