You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/sync.md
+75-2Lines changed: 75 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ for tossup in sync_client.random_tossup(number=3, categories=["Science"]):
28
28
print(tossup)
29
29
```
30
30
31
-
However, you are likely to get an error if you do not capitalize properly or make a spelling mistake. Instead, if you have some sort of LSP installed (or all-in-one extensions like VSCode Python), then figuring out what you want will be a lot easier through importing the QBReader module's `types`.
31
+
However, you are likely to get an error if you do not capitalize properly or make a spelling mistake. Instead, if you have some sort of language server installed (or all-in-one extensions like VSCode Python), then figuring out what you want will be a lot easier through importing the QBReader module's `types`.
32
32
```py
33
33
from qbreader import types
34
34
@@ -38,7 +38,7 @@ Category = types.Category
38
38
for tossup in sync_client.random_tossup(number=3, categories=[Category.SCIENCE]):
39
39
print(tossup)
40
40
```
41
-
This way, while typing (:smile:), your LSP should give an autocomplete on this. This is usually a better strategy than trying to guess the string that is right.
41
+
This way, while typing (:smile:), your language server should give an autocomplete on this. This is usually a better strategy than trying to guess the string that is right.
42
42
43
43
## Tossup by Difficulty
44
44
@@ -64,3 +64,76 @@ for bonus in sync_client.random_bonus(three_part_bonuses=True):
64
64
for bonus in sync_client.random_bonus(number=3, difficulties=[4, 5], min_year=2010, max_year=2020, categories=[Category.FINE_ARTS] three_part_bonuses=True):
65
65
print(bonus)
66
66
```
67
+
68
+
# Examples
69
+
70
+
## Simple quizbowl trainer CLI
71
+
72
+
Here is a working example of a simple quizbowl trainer CLI.
73
+
74
+
```py
75
+
from qbreader import Sync
76
+
import time
77
+
78
+
# Set up synchronous client
79
+
sync_client = Sync()
80
+
81
+
# Set up session configuration
82
+
num_correct =0
83
+
num_tossups =int(input("How many tossups do you want to answer? "))
0 commit comments