#๐ Random question number setter doesnt work
35 messages ยท Page 1 of 1 (latest)
@mossy vortex
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
for ques in range (1, questions_count +1):
print("Current score:" + str(score))
print("Question " + str(ques)+ " of " + str(questions_count))
if ques == questions_count:
print("Challenge question!")
# Challenge now also respects difficulty range
question_text = create_question(min_num, max_num)
else:
question_text = create_question(min_num, max_num)
correct, time_taken = ask_question(question_text)
if correct:
if ques == questions_count:
points = max(20 - time_taken, 1)
else:
points= max(10 - time_taken, 1)
score += points
correct_answers += 1
print("Correct! You took" ,time_taken, "seconds and earned",points, "points")
else:
points = 0
print("Incorrect! You took",time_taken, "seconds and earned",points, "points")
results.append((question_text, correct, time_taken, points))
print("Final score: "+ str(score))
print("Total correct answers: " +str(correct_answers))
total_questions =len(results)
total_time_taken = sum([entry[2] for entry in results])
average_time = round(total_time_taken / total_questions)
percentage = round((correct_answers / total_questions) *100)
print("\nTEST RESULTS")
print("Final score",score)
print("Correct answer rate:", percentage, "%")
print("Average reponse time:", average_time,"s")
print("Question\tCorrect\tTime")
question_number = 1
for entry in results:
if entry[1]:
correct_str = "Yes"
else:
correct_str= "No"
print(question_number,"\t\t", correct_str + "\t" + str(entry[2]), "s")
question_number +=1
Hey @mossy vortex!
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
And what's actually happening?
Also, the three backticks need to be on their own line
so basically in this code, if easy is selected its supposed to set the minimum ammount of questions generated as 5, the max is 10, medium is supposed to be between 10 and 20, hard is between 15 and 50
ohh im sorry
Yes, but what's actually happening?
What's your question?
i cant get it that to work
like for some reason its not generating a random ammount of questions
You don't seem to ever call the functions.
it always 5-10 for easy, 1-10 for medium and 1-15 for hard
Oh, nvm, the second code is different
thats easy to programn in with a dictionary if u know those
!pastebin
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
can u shove ur entire code here btw please
done
You need to paste the link here
so now click paste and send us link please
There doesn't seem to be any code here that attempts to generate a random number of questions.
for ques in range (1, questions_count +1):
ohhh
how do i fix it ive been like trying to find a fix it since yesterday ๐ญ
You appear to know how to generate a random number already.
yeah that bit was easy, i learnt it through youtube
how do i get it to generate a number inbetween set numbers, depeneding on wether the user selected easy, medium or hard
thats the hard bit
You're setting questions_count already depending on the difficulty.
okay
i fixed it
thank yall so much <333
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.