I'm making a quiz in python and was wondering how I would read different text files depending on the user
For example, the user can pick 'easy', 'medium' or 'hard' and the quiz would loads one of 3 text files depending on what button they clicked.
Thanks
file_dict= {'easy':'quiz_easy.txt','medium':'quiz_medium.txt','hard':'quiz_hard.txt'}
def button_click(qtype):
print("Trying to open file...",file_dict[qtype])
if qtype in file_dict.keys():
try:
f = open(file_dict[qtype], "r")
print("The file", file_dict[qtype], "has opened.")
except:
print("Error opening file", file_dict[qtype])
else:
print("file is not defined for the button", qtype)
button_click('easy')
button_click('medium')
button_click('hard')
I'm making a quiz in python and was wondering how I would read different text files...
In c++. I have 6 different text files that I want my program to read during different runs. How would I make it so that i can read a select whichi file I want it to read during each run?
I am writing an angular application, and I'm wondering how much client side memory to use. I'm currently working on a scenario where there are 2 dropdowns. The second will load new values depending on the selection of the first. I'm thinking the max # of total records in the 2nd dropdown would be around 2000-3000 items, each being around 2k each. Each selection would display probably 10-15 items of the 2000-3000. Should I load the entire array into memory...
****THIS IS A 2 PART QUESTION! I ONLY NEED THE ANSWER TO PART 2
ON HOW TO SEND THE DATA SERIALIZED****
Write a c# program that stores student grades in a text file and
read grades from a text file. The program has the
following GUI:
There are four buttons: Create File, Save Case, Close File and
Load File. Initially, only the Create File and Load File
buttons are enabled. If the user clicks the Create File
button, a Save File Dialog window...
Im stuck. can someone please show me code on how i can make text appear on html canvas. i want to create a form where someone for example put their name and when submit button is clicked on the form it appear on the canvas. i am using html javascript. please show code for javascript, canvas, and html. please let me know if im not making sense. Thank you
can anyone show me how this code would look in python, I'm studying python while taking some classes. I can't seem to understand what this is asking for. • Phase 1 Requirements Code submitted for Phase 1 will only have the following capability. Any additional coding will result in the loss of point. • code will have the main function, including looping until the user enters input of 12 • code will call the printMenu() function • The printMenu() function...
How do i write a program to read muliple files? i can read one
but i need to read 10: 0.txt - 9.txt
Here is the code for reading one but i need to read 10 text
files and print the frequencies of all the letters a - z, upper and
lowercase, in one take.
here is the output i should get
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <omp.h> int main() { double start_time = omp_get_wtime(); char str[1000); int...
I'm reading through Mark Seeman's Dependency Injection in .NET (excellent read so far) and something is escaping me. If the application's architecture is like [DAL] => [BLL] <= [UI], with the Business Logic Layer free of dependencies upon Data Access and UI layers (and both dependent upon the BLL), and if the composition root is located in the UI layer, then how on Earth are we supposed to be able to bind the interface of a type in the BLL...
I really need some help with some direction as to how this
should look. I'm wondering how I should start.
Cumulative Spreadsheet Analysis
Beginning with Chapter 2, each chapter in this text will include a
spreadsheet assignment based on the financial information of a
fictitious company named Skywalker Enterprises. The assignments
start out simple—in this chapter you are not asked to do much more
than set up financial statement formats and input some numbers. In
succeeding chapters, the spreadsheets will...
Using Java how would I write a program that reads and writes from binary or text files and gives me an output similar to this? Example Output: --------------------Configuration: <Default>-------------------- Enter the file name: kenb Choose binary or text file(b/t): b Choose read or write(r/w): w Enter a line of information to write to the file: lasdklj Would you like to enter another line? Y/N only n Continue? (y/n)y Enter the file name: kenb Choose binary or text file(b/t): b Choose...
I'm a bit confused on how to get this program to run right. Here are the directions: Part 1: Write a Python function called reduceWhitespace that is given a string line and returns the line with all extra whitespace characters between the words removed. For example, ‘This line has extra space characters ‘ ‘This line has extra space characters’ Function name: reduceWhitespace Number of parameters: one string line Return value: one string line The main file should handle the...