can anyone help me code for computer science? Watch

camdog
Badges: 2
Rep:
?
#1
Report Thread starter 3 weeks ago
#1
I need help doing the NEA. it is a music quiz game that I need to progamme
0
reply
wizkid44
Badges: 11
Rep:
?
#2
Report 2 weeks ago
#2
what exam board is it?
0
reply
Acsel
  • Community Assistant
Badges: 20
Rep:
?
#3
Report 2 weeks ago
#3
We can help, but we won't do the work for you.

If you want help, you need to actually post the problem you are having. Generally that'll mean posting snippets of code, telling us what you have tried and where you are stuck. Don't just post everything and don't expect any help starting from scratch.
0
reply
ltsmith
Badges: 19
Rep:
?
#4
Report 2 weeks ago
#4
stackoverflow dot com op
0
reply
Acsel
  • Community Assistant
Badges: 20
Rep:
?
#5
Report 2 weeks ago
#5
(Original post by ltsmith)
stackoverflow dot com op
They'd get laughed off stackoverflow for posting a question like this. The community over there is even more insistent that you do your own work and come to them only when you have a problem. As it should be of course.
1
reply
ltsmith
Badges: 19
Rep:
?
#6
Report 2 weeks ago
#6
(Original post by Acsel)
They'd get laughed off stackoverflow for posting a question like this. The community over there is even more insistent that you do your own work and come to them only when you have a problem. As it should be of course.
ofc

but its an invaluable place for fixing bugs
0
reply
mp__786
Badges: 4
Rep:
?
#7
Report 1 week ago
#7
Please can you help me figure out why this code aint working. What external files need to be added. Dont mind the dedents.


import sys
import random
import tkinter
from tkinter import *
count = 1
while count == 1:
username=str(input("what is your name"))
password=str(input("enter your password"))
userandpass= ((password) + (username))


f = open('test.txt','a+')



if (userandpass) in open('test.txt').read():
print("welcome back " + (username))
f.close()
count = count+ 1

else:
print("sadly you dont exist yet, we will set up an account!")
f.write(" " + (userandpass) + " ")
f.close()
f.close()




score = 0
file = open("artists.txt", "rt")
lines = file.readlines()
contents = (lines[2])
line = (contents)
two = (lines[2])
file.close()

file = open("artists.txt", "rt")
lines = file.readlines()


contents = (lines[3])
line = (contents)
three = (lines[3])
file.close()

file = open("tracks.txt", "rt")


lines = file.readlines()
x = 1
goes = int(input("how many goes"))
goes1 = goes + 1
for x in range (1,(goes1)):
select = random.randint(1,2)








if select == 1:
attempts = 0


while True:

contents = (lines[2])
line = (contents)
words = line.split()
letters = [word[0] for word in words]
print ("".join(letters) + " " + three)
guess = input("what do you guess")

true()

if guess != ("eyes of a panther") and attempts == 0:
print("wrong! one go left!")
attempts = attempts + 1
print(score)
guess = input("what do you guess")
if guess != ("eyes of a panther") and attempts == 1:
print("you lose")
print(score)
sys.exit()
if guess == ("eyes of a panther") and attempts == 0:
score = score + 3
print (score)
x = x + 2
if guess == ("eyes of a panther") and attempts == 1:
score = score + 1
print(score)



if select == 2:
attempts = 0

while True:
contents = (lines[1])
line = (contents)
words = line.split()
letters = [word[0] for word in words]
print ("".join(letters) + " " + two)
guess = input("what do you guess")
true()

if guess != ("i like drugs") and attempts == 0:
print("wrong! one go left!")
attempts = attempts + 1
print(score)
guess = input("what do you guess")
if guess != ("i like drugs") and attempts == 1:
print("you lose")
print(score)
sys.exit()
if guess == ("i like drugs") and attempts == 0:
score = score + 3
print (score)
x = x + 2
if guess == ("i like drugs") and attempts == 1:
score = score + 1
print(score)


score1 = str(score)
topscores = open("topscores.txt", "a+")
topscores.write((score1) + ',' + (username) + "\n")
topscores.close()
top=tkinter.Tk()
def scores():
import csv
import operator
tester= open("top5scores.txt", "a+")

winnerfile = open("topscores.txt", "r")
csv1 = csv.reader(winnerfile,delimiter= ',')

sort = sorted(csv1,key=operator.itemget ter(1), reverse=True)
for eachline in sort:
string=str(eachline)
tester.write(string + "\n")
print("\n" + string + "\n")

remove =+ 1
if remove >= 5:
f = open( 'top5.txt', 'r' )
lines = f.readlines()
f.close()
f = open( 'top5.txt','w' )
f.write( '\n'.join( lines[1:] ) )
f.close()
A = tkinter.Button(top, text="Click me for score", command = scores)
A.pack()

score()
0
reply
Acsel
  • Community Assistant
Badges: 20
Rep:
?
#8
Report 1 week ago
#8
(Original post by mp__786)
Please can you help me figure out why this code aint working. What external files need to be added. Dont mind the dedents.


import sys
import random
import tkinter
from tkinter import *
count = 1
while count == 1:
username=str(input("what is your name")
password=str(input("enter your password")
userandpass= ((password) + (username))


f = open('test.txt','a+'



if (userandpass) in open('test.txt'.read():
print("welcome back " + (username))
f.close()
count = count+ 1

else:
print("sadly you dont exist yet, we will set up an account!"
f.write(" " + (userandpass) + " "
f.close()
f.close()




score = 0
file = open("artists.txt", "rt"
lines = file.readlines()
contents = (lines[2])
line = (contents)
two = (lines[2])
file.close()

file = open("artists.txt", "rt"
lines = file.readlines()


contents = (lines[3])
line = (contents)
three = (lines[3])
file.close()

file = open("tracks.txt", "rt"


lines = file.readlines()
x = 1
goes = int(input("how many goes")
goes1 = goes + 1
for x in range (1,(goes1)):
select = random.randint(1,2)








if select == 1:
attempts = 0


while True:

contents = (lines[2])
line = (contents)
words = line.split()
letters = [word[0] for word in words]
print ("".join(letters) + " " + three)
guess = input("what do you guess"

true()

if guess != ("eyes of a panther" and attempts == 0:
print("wrong! one go left!"
attempts = attempts + 1
print(score)
guess = input("what do you guess"
if guess != ("eyes of a panther" and attempts == 1:
print("you lose"
print(score)
sys.exit()
if guess == ("eyes of a panther" and attempts == 0:
score = score + 3
print (score)
x = x + 2
if guess == ("eyes of a panther" and attempts == 1:
score = score + 1
print(score)



if select == 2:
attempts = 0

while True:
contents = (lines[1])
line = (contents)
words = line.split()
letters = [word[0] for word in words]
print ("".join(letters) + " " + two)
guess = input("what do you guess"
true()

if guess != ("i like drugs" and attempts == 0:
print("wrong! one go left!"
attempts = attempts + 1
print(score)
guess = input("what do you guess"
if guess != ("i like drugs" and attempts == 1:
print("you lose"
print(score)
sys.exit()
if guess == ("i like drugs" and attempts == 0:
score = score + 3
print (score)
x = x + 2
if guess == ("i like drugs" and attempts == 1:
score = score + 1
print(score)


score1 = str(score)
topscores = open("topscores.txt", "a+"
topscores.write((score1) + ',' + (username) + "\n"
topscores.close()
top=tkinter.Tk()
def scores():
import csv
import operator
tester= open("top5scores.txt", "a+"

winnerfile = open("topscores.txt", "r"
csv1 = csv.reader(winnerfile,delimiter= ','

sort = sorted(csv1,key=operator.itemget ter(1), reverse=True)
for eachline in sort:
string=str(eachline)
tester.write(string + "\n"
print("\n" + string + "\n"

remove =+ 1
if remove >= 5:
f = open( 'top5.txt', 'r' )
lines = f.readlines()
f.close()
f = open( 'top5.txt','w' )
f.write( '\n'.join( lines[1:] ) )
f.close()
A = tkinter.Button(top, text="Click me for score", command = scores)
A.pack()

score()
Please don't hijack other people's threads.

Please use the code block (it's under the advanced tab) when adding code. It's far more readable and preserves things like indentation.

Please don't post huge chunks of code and ask what's wrong. You haven't told us what language you are using, any errors or what's not working, what the code is supposed to do and so on. If you want help fixing code, post the snippet of code causing the problem and describe what you have already tried.
0
reply
X

Quick Reply

Attached files
Write a reply...
Reply
new posts
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

University open days

  • University of Bath
    Undergraduate Virtual Open Day Undergraduate
    Sat, 23 Feb '19
  • Ravensbourne University London
    School of Design, School of Media Further education
    Sat, 23 Feb '19
  • Leeds Trinity University
    PGCE Open Day Further education
    Sat, 23 Feb '19

Do you have a food intolerance or allergy?

Yes - a food intolerance (81)
14.16%
Yes - a food allergy (60)
10.49%
Yes - an autoimmune disorder (i.e coeliac, colitis) (15)
2.62%
Yes - I have an intolerance and allergy (15)
2.62%
No (401)
70.1%

Watched Threads

View All