Datasets:

Modalities:
Image
Text
Formats:
parquet
ArXiv:
License:
Dataset Viewer
Auto-converted to Parquet Duplicate
image
imagewidth (px)
1.7k
1.7k
id
stringlengths
13
16
text
stringlengths
0
4.99k
corpus-test-0
openstax TM Introduction to Python P
corpus-test-1
corpus-test-2
Preface 1 Preface About OpenStax OpenStax is part of Rice University, which is a 501(c)(3) nonprofit charitable corporation. As an educational initiative, it's our mission to improve educational access and learning for everyone. Through our partnerships with philanthropic organizations and our alliance with other educa...
corpus-test-3
Decisions Figure 4.1 credit: modification of work "Fork The Road", by Ian Sane/Flickr, CC BY 2.0 Chapter Outline 4.1 Boolean values 4.2 If-else statements 4.3 Boolean operations 4.4 Operator precedence 4.5 Chained decisions 4.6 Nested decisions 4.7 Conditional expressions 4.8 Chapter summary Introduction The Python int...
corpus-test-4
92 4 Decisions bool data type People often ask binary questions such as yes/no or true/false questions. Ex: Do you like pineapple on pizza? Ex: True or false: I like pineapple on pizza. The response is a Boolean value, meaning the value is either true or false. The bool data type, standing for Boolean, represents a bin...
corpus-test-5
4.1 Boolean values 93 Suppose the following is added to the code above: is_dessert = 0 print (itype(ss_ddsertt) What is the output? a. <class 'bool'> b. <class 'int'> C. Error Type conversion with bool() Deciding whether a value is true or false is helpful when writing programs/statements based on decisions. Converting...
corpus-test-6
94 4 Decisions a. True b. False | CONCEPTS IN PRACTICE | | Converting Booleans to numeric types and strings | | Given is_on = True, what is the value of each expression? | | a. 0.0 12. (loat(is_on) | | b. 1.0 | | 13. str(is_on) | | a. "is_on" | | b. "True" | | 14. ins(os_on) | | a. 0 | | b. 1 | Comparison operators Pro...
corpus-test-7
4.1 Boolean values 95 CONCEPTS IN PRACTICE Comparing values For each new variable, what is the value of compare_result? 15. X = 14 compare_result = (x <= 13) a. True b. False 16. W = 0 compare_result = (w != 0.4) a. True b. False 17. v = 4 compare_result = = (v < <4.0) a. True b. False 18. y = 2 compare_result = (y > "...
corpus-test-8
96 4 Decisions = VS == A common mistake is using = for comparison instead of ==. Ex: is zero = num=0 will always assign is_zero and num with 0, regardless of num's original value. The operator performs assignment and will modify the variable. The == operator performs comparison, does not modify the variable, and produc...
corpus-test-9
4.2 If-else statements 97 numbers. If the result is negative, the program prints an error. A condition is an expression that evaluates to true or false. An if statement is a decision-making structure that contains a condition and a body of statements. If the condition is true, the body is executed. If the condition is ...
corpus-test-10
98 4 Decisions 2 if is_raining: 3 print("Don's forget an umbrella!") 4 print("Sea you soon.") a. 1,2,3 b. 1,2,4 C. 1,2,3,4 4. Given num = -0, what is the final value of num? if num < 0: num = 25 if num < 100: num = num + 50 5. Given input 10, what is the final value of positive_num? positive_num = int (input ("Enter a ...
corpus-test-11
4.2 If-else statements 99 # Statements after CHECKPOINT Example: Trivia question Access multimedia content http:///oo....oooooooooooooooooo else-statements) CONCEPTS IN PRACTICE Exploring if-else statements 6. Given the following code, the else branch is taken for which range of x if X >= 15: # Do something else: # Do ...
corpus-test-12
100 4 Decisions TRY IT Improved division The following program divides two integers. Division by O produces an error. Modify the program to read in a new denominator (with no prompt) if the denominator is 0. Access multimedia content http://eeeeeooo//tttoiiioooooeee else-statements) TRY IT Converting temperature units ...
corpus-test-13
2 Preface Introduction to Python Programming is an interactive offering that teaches basic programming concepts, problem-solving skills, and the Python language using hands-on activities. The resource includes a unique, integrated code runner, through which students can immediately apply what they learn to check their ...
corpus-test-14
| p | q | p and q | | True | True | True | | True | False | False | | False | True | False | | False | False | False | | | | Table 4.1 Truth table: p and q. | 4.3 Boolean operations 101 CHECKPOINT Example: Museum entry Access multimedia content httpp//eeeea.ooooooooooooooomomo CONCEPTS IN PRACTICE Using the and opera...
corpus-test-15
102 4 Decisions Logical operator: or Sometimes a decision only requires one condition to be true. Ex: If a student is in the band or choir, they will perform in the spring concert. The or operator takes two condition operands and returns True if either condition is true a | operator takes two condition opera | operator...
corpus-test-16
4.3 Boolean operations 103 # TTes passed # TTst failed a. yes b. no Logical operator: not If the computer is not on, press the power button. The not operator takes one condition operand and returns True when the operand is false and returns False when the operand is true. is a useful operator that can make a condition ...
corpus-test-17
104 4 Decisions if timer > 60: is turn = not is turn a. True b. False TRY IT Speed limits Write a program that reads in a car's speed as an integer and checks if the car's speed is within the freeway limits. A car's speed must be at least 45 mph but no greater than 70 mph on the freeway. If the speed is within the limi...
corpus-test-18
4.4 | | Operator | Meaning | | | not | Logical not operator | | | and | Logical and operator | | | or | Logical or operator | | | | Table 4.4 Operator precedence from highest to lowest. | | CHECKPOINT | | | 4.4 Operator precedence 105 Operator precedence Access multimedia content httpt///essssooooooooooooooooto...
corpus-test-19
106 4 Decisions comparisons and evaluated from left to right. Ex. 10 <= 20 is evaluated as 10 x and x <= 20. CHECKPOINT Operation precedence Access multimedia content hhtp:/peeeraoooooooooottoooooooo | CONCEPTS IN PRACTICE | | Associativity | | How is each expression evaluated? | | 4. 10 + 3 * 2 / 4 | | a. 10 + (3 * (2...
corpus-test-20
4.5 Chained decisions 107 b. All operators are evaluated right to left. C. Order is random when parentheses aren't used. 8. Given x = 8 and y = 9, what is the result of the following? X + 3 * y 5 a. 30 b. 44 C. 94 9. Given x = 8 and y = 9, what is the result of the following? (x+3) * (y-5) a. 30 PEP 8 RECOMMENDATIONS: ...
corpus-test-21
108 4 Decisions Two separate if statements do not guarantee that only one branch is taken and might result in both branches being taken. Ex: The program below attempts to add a curve based on the input test score. If the input is 60, both if statements are incorrectly executed, and the resulting score is 75. score = in...
corpus-test-22
4.5 Chained decisions 109 C. else 2. Given X = 42 and y = 0, what is the final value of y? if x > 4 y += 2 elif x < 50: y += 5 a. 2 b. 5 C. 7 3. Which conditions complete the code such that if x is less than 0, Body 1 executes, else if x equals 0, Body 2 executes. if # Body 1 elif # Body 2 a. x < 0 x == 0 b. x == 0 x <...
corpus-test-23
110 4 Decisions elif attendees <= 4000: : rooms += 14 a. 4 b. 15 C. 18 if-elif-else statements Elifs can be chained with an else statement to create a more complex decision statement. Ex: A program shows possible chess moves depending on the piece type. If the piece is a pawn, show moving forward one (or two) places. E...
corpus-test-24
Preface 3 The code runner requires the reader to pre-enter any input before running a program. Many of the programs in this chapter expect input from the user. Enter your name in the Input box below the code. Run the program again, and see what changes. Copy the following lines to the end of the program: print ("What i...
corpus-test-25
4.5 Chained decisions 111 2 elif condition: # Body 3 else: # Body 8. Given x = - andy = 2, what is the final value of y? if x < 0 and y 0: y = 10 elif x < 0 and y 0: y = 20 else: y = 30 9. How could the following statements be rewritten as a chained statement? if price < 9.99: order = 50 if 9.99 <= price < 19.99: order...
corpus-test-26
112 4 Decisions elif price < 19.99 order = 30 else: order = 10 TRY IT Crochet hook size conversion Write a program that reads in a crochet hook's US size and computes the metric diameter in millimeters. (A subset of sizes is used.) If the input does not match B-G, the diameter should be assigned with -1.0. Ex: If the i...
corpus-test-27
4.6 Nested decisions 113 Green Access multimedia content httpp/p///oooooooooooooooooooooo Nested decisions Learning objectives By the end of this section you should be able to Describe the execution paths of programs with nested if else statements Implement a program with nested if-else statements. Nested decision stat...
corpus-test-28
114 4 Decisions if players < 3: print ("Not enough players") elif players > 6: print ("Too many players") else: print ("Ready to start") # Test game IDs 3-end CHECKPOINT Example: Poisonous plant identification Access multimedia content http:////pptoooooooooooooooooooo CONCEPTS IN PRACTICE Using nested if-else statement...
corpus-test-29
4.6 Nested decisions 115 # Body 4 else: # Body 5 a. Body 2 b. Body 2, Body 3 C. Body 2, Body 5 4. Given x =118, y = 300, and max = 512, which of the following will execute? if x == y: # Body 1 elif x < y: # Body 2 if y == max: # Body 3 else: # Body 4 else: # Body 5 a. Body 2 b. Body 3 TRY IT Meal orders Write a program...
corpus-test-30
116 4 Decisions Access multimedia content http Conditional expressions Learning objectives By the end of this section you should be able to Identify the components of a conditional expression. Create a conditional expression. Conditional expressions A conditional expression (also known as a "ternary operator") is a sim...
corpus-test-31
4.7 Conditional expressions 117 c. response =eevn"" if x == 0 else "odd" 2. Given X = 100 and offset = 10, what is the value of result? result = x + offset if x < <00 else X - offset 3. Which part of the conditional expression is incorrect? min_num = x if x < y else min_num = y a. min_num = X b. x y C. min_num = y 4. W...
corpus-test-32
118 4 Decisions Chapter summary Highlights from this chapter include: Booleans represent a value of True or False. Comparison operators compare values and produce True or False. Logical operators take condition operand(s) and produce True or False. Operators are evaluated in order according to precedence and associativ...
corpus-test-33
| | 4.8 Chapter summary | | Function | Description | | x and y (Logical) | Evaluates the Boolean values of x and y and returns True if both are true. Ex: True and False is False. | | x or y (Logical) | Evaluates the Boolean values of x and y and returns True if either is true. Ex: True or False is True. | | not x (Log...
corpus-test-34
120 | 4 Decisions | | | Function | Description | | | # Statements before | | | if condition: | | | elif condition: | | | # Body | | | else: # Body | | elif statement | # Statements after # Body | | | # Statements before | | Nested if statement | else: # Body else: if condition: if condition: if condition: # Body...
corpus-test-35
4 Preface About the Authors Senior Contributing Authors Senior contributing authors, left to right: Udayan Das, Aubrey Lawson, Chris Mayfield, and Narges Norouzi. Udayan Das, Saint Mary's College of California Udayan Das, PhD, is an Associate Professor and Program Director of Computer Science at Saint Mary's College of...
corpus-test-36
5 Loons Loops Figure 5.1 credit: modification of work "Quantum Computing", by Kevin Dooley/Flickr; CC BY 2.0 Chapter Outline 5.1 While loop 5.2 For loop 5.3 Nested loops 5.4 Break and continue 5.5 Loop else 5.6 Chapter summary Introduction A loop is a code block that runs a set of statements while a given condition is ...
corpus-test-37
122 5 Loops loop expression is evaluated again. true, the loop body will execute at least one more time (also called looping or iterating one more time). false, the loop's execution will terminate and the next statement after the loop body will execute. CHECKPOINT While loop Access multimedia content fftp:///pppt.ooooo...
corpus-test-38
5.1 While loop 123 Counting with a while loop A while loop can be used to count up or down. A counter variable can be used in the loop expression to determine the number of iterations executed. Ex: A programmer may want to print all even numbers between 1 and 20. The task can be done by using a counter initialized with...
corpus-test-39
124 5 . Loops 4. How many times does the loop execute? a. 3 b. 4 C. 5 5. Which line is printed as the last line of output? a. value of n after the loop is - -1. b. value of n after the loop is 0. C. value of n after the loop is 1. 6. What happens if the code is changed as follows? n = 4 while n 0: print(n) # Modified l...
corpus-test-40
5.2 For loop 125 For loop Learning objectives By the end of this section you should be able to Explain the for loop construct. Use a for loop to implement repeating tasks. For loop In Python, a container can be a range of numbers, a string of characters, or a list of values. To access objects within a container, an ite...
corpus-test-41
126 5 Loops str_var = = "A string" count = 0 for c in str_var: count += 1 #New line print(c, end = '*') print (count) a. A string* b. ************g* C. A* ***t* C. | Range() function in for loop | Range() function in for loop | | | | | A for loop can be used for iteration and counting. The range() function is a comm...
corpus-test-42
| | | | 5.2 For loop | | Range function | Description | Example | Output | | | | range (3, -2, -1) | 3, 2, 1, 0, -1 | | | | range (10, 0, -4) | 10, 6, 2 | | | Table 5.1 Using the range() function. | | | | EXAMPLE 5.2 | | | | 5.2 For loop 127 Two | programs printing all integer multiples of 5 less construct...
corpus-test-43
128 5 Loops 6. What is the sequence generated from range (-1, -2, -1)? a. 1 b. -,, -2 C. 2 7. What is the output of the range (1, 2, -1)? a. 1 b. 1, 2 C. empty sequence 8. What is the output of range (5, 2)? a. 0, 2, 4 b. 2, 3, 4 C. empty sequence TRY IT Counting spaces Write a program using a for loop that takes in a ...
corpus-test-44
5.3 Nested loops 129 Nested loops Learning objectives By the end of this section you should be able to Implement nested while loops. Implement nested for loops. Nested loops A nested loop has one or more loops within the body of another loop. The two loops are referred to as outer loop and inner loop. The outer loop co...
corpus-test-45
130 5 . Loops CONCEPTS IN PRACTICE Nested while loop question set 1. Given the following code, how many times does the print statement execute? i = 1 while i <= 5: j = 1 while i + j <= 5: print(i, j) j += 1 i += 1 2. What is the output of the following code? 3. Which program prints the following output? 1 2 3 4 2 4 6 8...
corpus-test-46
Preface 5 Yamuna Rajasekhar, PhD, is Director of Content, Authoring, and Research at Wiley. She works across disciplines on research strategy, authoring pedagogy and training, and content development for Computer Science and IT. She received her MS and PhD from University of North Carolina at Charlotte, focusing on Com...
corpus-test-47
5.3 Nested loops 131 i += 1 b. i = 1 while i <= 4: j = 1 while j <= 4: print (i * j, end = ) j += 1 print() i += 1 c. i = 1 while i <= 4: j = ==1 while j <= 4: print (i * j, end = ) j += 1 i += 1 Nested for loops A nested for loop can be implemented and used in the same way as a nested while loop. A for loop is a prefe...
corpus-test-48
132 5 Loops for j in range (4) print (i, '', j) a. 4 b. 12 C. 20 6. Which program prints the following output? 0 1 2 3 0 2 4 6 0 3 6 9 a. for i in range (4) : for j in range (4) : print(1 * j, end ) print() b. for i in range(1, 4) for j in range (4) print(1 * j) C. for i in range(1, 4) for j in range (4): : print (i * ...
corpus-test-49
5.4 Break and continue 133 TRY IT Printing a triangle of numbers Write a program that prints the following output: 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1 Finish! Access multimedia content http://ottopppppisrrrrrroprrr/oe 5-3-nested-loops) TRY IT Printing two triangles ...
corpus-test-50
134 5 Loops Break A break statement is used within a for or a while loop to allow the program execution to exit the loop once a given condition is triggered. A break statement can be used to improve runtime efficiency when further loop execution is not required. Ex: A loop that looks for the character "a" in a given st...
corpus-test-51
5.4 Break and continue 135 string_val = "Hello World" for c in string_val: if c == ":: break print (c) a. Hello b. Hello World 0 2. Given the following code, how many times does the print statement get executed? i = 1 while True: if i83 == 0 and i%5 == 0: print(i) break i + 1 a. 0 b. 1 C. 15 3. What is the final value ...
corpus-test-52
136 5 Loops CHECKPOINT Continue statement in a while loop Access multimedia content http://pppskoooooooooooooooggooo CONCEPTS IN PRACTICE CONCEP IS In pRaCTICE Using a continue statement 4. Given the following code, how many times does the print statement get executed? i = 10 while i >= 0: i == 1 if i%3 == 0: continue ...
corpus-test-53
5.5 Loop else 137 TRY IT Using break control statement in a loop Write a program that reads a string value and prints "Found" if string contains a space character. Else, prints "Not found". Access multimedia content fttt:///ooo...oooooooooooooooooo 5-4-brekk-ad-ccontiuue) Using a continue statement in a loop Complete t...
corpus-test-54
138 5 Loops the code prints "10 is not in the list.". numbers = [2, 5, 7, 11, 12] seen = False for i in numbers: if i == 10: print ("Found 10!") seen = True if seen == False: print ("10 is not in the list. numbers = [2, 5, 7, 11, 12] for i in numbers: : if i == 10: print ("Found 10!") break else: print ("10 is not in t...
corpus-test-55
5.5 Loop else 139 print (n, "is 2 to the", exp lumbers = [1, 2, 2, 6] or i in numbers: if i >= 5: print ("Not all numbers are less than 5.") break print ("all numbers are less than 5. a. 1 2 2 6 Not all numbers are less than 5. b. 1 2 2 Not all numbers are less than 5. c. 1 2 2 6 all numbers are less than 5.
corpus-test-56
140 5 . Loops TRY IT sum of values less than 10 Write a program that, given a list, calculates the sum of all integer values less than 10. If a value greater than or equal to 10 is in the list, no output should be printed. Test the code for different values in the list. Access multimedia content hitpg//oeea..../o////oo...
corpus-test-57
6 Preface Approved Ask Instructor Not Approved Your Original Work Quoting & Crediting Another's Work Checking Your Answers Online Group Work Reusing Past Original Work Sharing Answers Artificial Intelligence, Chatbot Apps Posting Questions & Answers Plagiarizing Work Work Getting Others To Do Your Work attribution: Cop...
corpus-test-58
5.6 Chapter summary | Function | Description | | whileloop | # initialization while expression: # statements after the loop # loop body | | for loop | initialization for Loop_variable in container: # loop body the # statements after loop | | Nested while loop | while outer_loop_expressio::: outer loop body (1) # # stat...
corpus-test-59
5 Loops | Function | Description | | continue statement | # loop body if continue_condition: # remaining body of loop # statements after the loop continue while loop_expression: # initialization | | Loop else statement | # loop else statement # initialization for loop_expression: # loop body if break_condition: break #...
corpus-test-60
5.6 Chapter summary 143 Access multimedia content hotpeppp/ooooooooooooooooooooooo
corpus-test-61
144 5 Loops Access for free at openstax.org
corpus-test-62
X WEST OMSTT TURTLES TURTLE LS 1N TIME 6 Functions Figure 6.1 credit: modification of work "IMG_3037", by Jay Roc/Flickr, Public Domain Chapter Outline 6.1 Defining functions 6.2 Control flow 6.3 Variable scope 6.4 Parameters 6.5 Return values 6.6 Keyword arguments 6.7 Chapter summary Introduction Functions are the nex...
corpus-test-63
146 6 Functions Calling a function Throughout the book, functions have been called to perform tasks. Ex: print () prints values, and sqrt() calculates the square root. A function is a named, reusable block of code that performs a task when called. CHECKPOINT Example: Simple math program Access multimedia content http:/...
corpus-test-64
6.1 Defining functions 147 Defining a function A function is defined using the def keyword. The first line contains def followed by the function name (in snake case), parentheses (with any parameters-discussedd later), and a colon. The indented body begins with a documentation string describing the function's task and ...
corpus-test-65
148 6 Functions Benefits of functions A function promotes modularity by putting code statements related to a single task in a separate group. The body of a function can be executed repeatedly with multiple function calls, so a function promotes reusability. Modular, reusable code is easier to modify and is shareable am...
corpus-test-66
6.2 Control flow 149 Access multimedia content http:/p///oooooooooooooooooooooa TRY IT Terms and conditions prompt Write a function, terms (), that asks the user to accept the terms and conditions, reads in Y/N, and outputs a response. In the main program, read in the number of users and call terms () for each user. Gi...
corpus-test-67
150 6 Functions CHECKPOINT Calling a brunch menu function Access multimedia content http:///ppoooooooooooooooooomooo 6-2-control-flow) CONCEPTS IN PRACTICE Following the control flow 1. Which line is executed first? def park_greet() : """Output greeting."" print ("Welcome. Open sunrise to sunset.") car_count = 1 park_g...
corpus-test-68
def where_ is(point): ary litt natch point: case Point(xx00 y-0): eccinng Lists print("Origin") case Point(x-0, yey): case Point(xxx, y=0): ns case Point(): print( ("Somewhere else") ms I V { F2 U S A @ 1 Statements Figure 1.1 credit: Larissa Chu, CC BY 4.0 Chapter Outline 1.1 Background 1.2 Input/output 1.3 Variables ...
corpus-test-69
6.2 Control flow 151 print ("Take the second right to park.") def park_greet(): """Output greeting."" print ("Welcome. Open sunrise to sunset.") car_count = 1 park_greet() if car_count > 50: extra_lot() a. 5 b. 8 C. 12 4. What is the output? def park_greet () """Output greeting." print ("Welcome to the park") print ("O...
corpus-test-70
152 6 Functions 5. How many function calls occur during the execution of the program? 6. When line 3 is reached and executed, which line does control flow return to? a. 1 b. 11 C. 16 TRY IT Updated terms and conditions prompt Write an updated function, terms (), that asks the user to accept the terms and conditions, re...
corpus-test-71
6.3 Variable scope 153 Given inputs 50 and 40, the output is Liam's Laundry 7a - 11p Open washers: 50 Open dryers: 40 Access multimedia content http:/pooooooooooooooocoooooomeo Variable scope Learning objectives By the end of this section you should be able to Identify the scope of a program's variables. Discuss the im...
corpus-test-72
154 6 Functions num_sq = num num print (num, "squared is", num_sq) num = float (input ()) ) print_square a. num only b. num_sq only c. num and num_sq 3. Which functions can access num? def print_double() num_d = num * 2 print (num, "doubled is", num_d) def print_square(1 num_sq = num num print (num, "squared is", num_s...
corpus-test-73
6.3 Variable scope 155 def print_time(() out_str "Time is + str(hour) ":" + str(min) print(out_str) hour = (nt(in min = int (input a. hour and min b. out_str c. hour, min, and out_str 5. Which variables are local? def print_greeting (): : prunt(out_ssr) hour = int(inpu(()) min int (itpun ()) if hour < 12: out_str "Good...
corpus-test-74
156 6 Functions Using local and global variables together Python allows global and local variables to have the same name, which can lead to unexpected program behavior. A function treats a variable edited within the function as a local variable unless told otherwise. To edit a global variable inside a function, the var...
corpus-test-75
6.3 Variable scope 157 a. New hour: 9 b. New hour: 10 C. Error 9. What is the output? Enter hour: ) update_hour() print ("New hour:", new_hour) def update_hour() global new_hour new_hour = hour if is_dst: new_hour += 1 else: new_hour = 1 is_dst = True hour = int (input ("Enter hour: ") ) update_hour() print ("New hour:...
corpus-test-76
158 6 Functions practice (): Reads in a string representing the desired map. Prints "Launching practice on [desired map]". Note: find_teammates () is provided and does not need to be edited. Given input: The output is: Finding 2 players. Match starting Given input The output is: Launching practice on Queen's Canyon Acc...
corpus-test-77
6.4 Parameters 159 CHECKPOINT Global and local variables in a program with a function Access multimedia content http://ooo....oooooocooooooomemo 6-4-parameters) CONCEPTS IN PRACTICE Arguments and parameters Consider the following: 1 def print_welcome (name) 2 print (f"Welcome {name}!") 3 4 username = int (input ( ("Ent...
corpus-test-78
160 6 Functions def print_div(op_1) op_2): """ Prints division operation """ print (fp_opp_}\/op__} = {op_1/op_2}") num 1 = 6 num_2 = 3 print_div (num_,, num 2) # Prints "6/3 = 2.0" print_div (num_ 2, num_1) # Prints "3/6 = 0.5" print_div (num_ 1) # Error: Missing argument: op 2 CONCEPTS IN PRACTICE Multiple arguments ...
corpus-test-79
8 1 Statements Background Learning Objectives By the end of this section you should be able to Name two examples of computer programs in everyday life. Explain why Python is a good programming language to learn. Computer programs A computer is an electronic device that stores and processes information. Examples of comp...
corpus-test-80
6.4 Parameters 161 uses a pass-by-object-referenne system. If an argument is changed in a function, the changes are kept or lost depending on the object's mutability. A mutable object can be modified after creation. A function's changes to the object then appear outside the function. An immutable object cannot be modif...
corpus-test-81
162 6 Functions CONCEPTS IN PRACTICE Mutability and function arguments 8. In convert_temps (), wknd_temps and temps refer to in memory. a. the same object b. different objects 9. After unit is assigned with "C", metric and unit refer to in memory a. the same object b. different objects 10. deg_sign is a string whose va...
corpus-test-82
6.5 Return values 163 points to add. For each score, print the original score and the sum of the score and bonus. Make sure not to hange the list. siven function call: print_scores (667, 68, 72, 71, 69], 10) The output is: 67 would be updated to 77 68 would be updated to 78 72 would be updated to 82 71 would be updated...
corpus-test-83
164 6 Functions mpg miles/gallons return mpg a. mpg b. None C. Error 2. What is returned by calc_sqft ()? def calc_sqft (length, width) sqft = llegtt * width 3. What is the difference between hw_1() and hw_2()? def hw_1() print ("Hello world!") return def hw_2() print ("Hello world!") a. hw_1() returns a string, hw_2()...
corpus-test-84
| indicate problem. | | | | a CONCEPTS IN | def calc_mpg (miles, gallons): if gallons 0: miles/gallons mpg = return mpg else: print ("Gallons can't be 0") return -1 | Car 1's mpg is 28.0 Gallons can't be 0 Car 2's mpg is -1 | | | car_1_mpg = calc_mpg(448, 16) print ("Car 1's is", 1_mpg mpg car 2_mpg calc_mpg (300, 0...
corpus-test-85
166 6 Functions if level < max return level level += 1 else return level voll = inc_volume (9, 10) print (voll) vol2 = inc_volume (10, 10) print (vol2) Using functions as values uunctions are objects that evaluate to values, so function calls can be used in expressions. A function call can combined with other function ...
corpus-test-86
6.5 Return values 167 b. 126.0 b. What is the value of val2? def sq(num) return num * num def offset (num) : return num 2 val = 5 val2 = dr(offse((vll) a. 9 TRY IT Estimated days alive Write a function, days_alive() that takes in an age in years and outputs the estimated days the user has been alive as an integer. Assu...
corpus-test-87
168 6 Functions 6.6 Keyword arguments Learning objectives By the end of this section you should be able to Describe the difference between positional and keyword arguments. Create functions that use positional and keyword arguments and default parameter values. Keyword arguments So far, functions have been called using...
corpus-test-88
6.6 Keyword arguments 169 C. 4. Which function call would produce an error? a. greeting ("Morning", "Morgan", count=3) b. greeting (count=1, "Hi", "Bea") greeting ("Cheers", "Colleagues", 10) Default parameter values Functions can define default parameter values to use if a positional or keyword argument is not provide...
corpus-test-89
170 6 Functions a. Hello Friend b. nothing C. Error PEP 8 RECOMMENDATIONS: SPACING The PEP 8 style guide recommends no spaces around = when indicating keyword arguments and default parameter values. TRY IT Stream donations Write a function, donate (), that lets an online viewer send a donation to a streamer. donate () ...
corpus-test-90
1.1 Background 9 EXPLORING FURTHER Later chapters of this book show how to write analysis programs using real data. Example libraries that provide access to online streaming services include /ttp://p/pppepttttrrrrrrr////ppp Pytube https://openttaa..rrrrrrrr//ppep and Pydora (ttpp://ppepnst...rr//////yyyrr. Python-relat...
corpus-test-91
6.7 Chapter summary 171 input by the calling code. Parameters are assigned with the arguments' values. Function calls can use positional arguments to map values to parameters in order. Function calls can use keyword arguments to map values using parameter names in any order. Functions can define default parameter value...
corpus-test-92
172 | 6 Functions | | | Construct | Description | | Keyword arguments | def function_name (parameter_1 parameter _2) # Function body function_name (parameter _ = 5, parameter _1 2) = | | Default parameter value | def function_name (parameter_1 100): = Function body # | | Table 6.2 Chapter 6 reference. | | Access for ...
corpus-test-93
Modules Figure 7.1 credit: modification of work "Lone Pine Sunset", by Romain Guy/Flickr, Public Domain Chapter Outline 7.1 Module basics 7.2 Importing names 7.3 Top-level code 7.4 The help function 7.5 Finding modules 7.6 Chapter summary Introduction As programs get longer and more complex, organizing the code into mo...
corpus-test-94
174 7 Modules Technically, every program in this book is a module. But not every module is designed to run like a program. Running greetings.py as a program would accomplish very little. Two functions would be defined, but the functions would never be called. These functions are intended to be called in other modules. ...
corpus-test-95
7.1 Module basics 175 """Gets the area of an ellipse. """ return math. pi *major *minor # 3D shapes # 3D shapes def sube(side) """Gets the surface area of a cube.""" return 6 * side**2 def cylinder(radius, height): """Gets the surface area of a cylinder."" return 2 * math.pi * radius * (radius + height) def cone(radius...
corpus-test-96
176 7 Modules import area print ("Area of a basketball court:", area. rectangle (94, 50)) print ("Area of a circus ring:", area. circle (21) The output is: Area of a basketball court: 4700 Area of a circus ring: 1385.4423602330997 CHECKPOINT Importing area in a Python shell Access multimedia content fttp:////oot.oooooo...
corpus-test-97
7.2 Importing names 177 The formula is 9/5 C + 32. 2. fah2cel (f) Converts a temperature in Fahrenheit to Celsius. The formula is 5/9 (f 32). 3. km2mi (km) Converts a distance in kilometers to miles. The formula is km / 1.60934. 4. mi2km ( (mi) ) Converts a distance in miles to kilometers. The formula is mi 1.60934. Ea...
corpus-test-98
178 7 Modules The from keyword Specific functions in a module can be imported using the from keyword: from area import triangle, cylinder These functions can be called directly, without referring to the module: print (triangle(1 2)) print (cylinder (3, 4)) EXPLORING FURTHER As shown below, the from keyword can lead to ...
corpus-test-99
7.2 Importing names 179 used rom area import cube def cube (x) # Name collision (replaces the imported function) return x ** 3 print (cube (2)) # Calls the local cube() function, not area. cube () A programmer might not realize the cube function is defined twice because no error occurs when running the program. Name co...
End of preview. Expand in Data Studio

Vidore3ComputerScienceOCRRetrieval

An MTEB dataset
Massive Text Embedding Benchmark

Retrieve associated pages according to questions. This dataset, Computer Science, is a corpus of textbooks from the openstacks website, intended for long-document understanding tasks. Original queries were created in english, then translated to french, german, italian, portuguese and spanish. This variant includes the OCR'ed markdown so allow for comparison across image-text and text-only models. It is currently released as a beta and might be removed at a later stage.

Task category t2it
Domains Engineering, Programming
Reference https://arxiv.org/abs/2601.08620

Source datasets:

How to evaluate on this task

You can evaluate an embedding model on this dataset using the following code:

import mteb

task = mteb.get_task("Vidore3ComputerScienceOCRRetrieval")
evaluator = mteb.MTEB([task])

model = mteb.get_model(YOUR_MODEL)
evaluator.run(model)

To learn more about how to run models on mteb task check out the GitHub repository.

Citation

If you use this dataset, please cite the dataset as well as mteb, as this dataset likely includes additional processing as a part of the MMTEB Contribution.


@article{loison2026vidorev3comprehensiveevaluation,
  archiveprefix = {arXiv},
  author = {António Loison and Quentin Macé and Antoine Edy and Victor Xing and Tom Balough and Gabriel Moreira and Bo Liu and Manuel Faysse and Céline Hudelot and Gautier Viaud},
  eprint = {2601.08620},
  primaryclass = {cs.AI},
  title = {ViDoRe V3: A Comprehensive Evaluation of Retrieval Augmented Generation in Complex Real-World Scenarios},
  url = {https://arxiv.org/abs/2601.08620},
  year = {2026},
}


@article{enevoldsen2025mmtebmassivemultilingualtext,
  title={MMTEB: Massive Multilingual Text Embedding Benchmark},
  author={Kenneth Enevoldsen and Isaac Chung and Imene Kerboua and Márton Kardos and Ashwin Mathur and David Stap and Jay Gala and Wissam Siblini and Dominik Krzemiński and Genta Indra Winata and Saba Sturua and Saiteja Utpala and Mathieu Ciancone and Marion Schaeffer and Gabriel Sequeira and Diganta Misra and Shreeya Dhakal and Jonathan Rystrøm and Roman Solomatin and Ömer Çağatan and Akash Kundu and Martin Bernstorff and Shitao Xiao and Akshita Sukhlecha and Bhavish Pahwa and Rafał Poświata and Kranthi Kiran GV and Shawon Ashraf and Daniel Auras and Björn Plüster and Jan Philipp Harries and Loïc Magne and Isabelle Mohr and Mariya Hendriksen and Dawei Zhu and Hippolyte Gisserot-Boukhlef and Tom Aarsen and Jan Kostkan and Konrad Wojtasik and Taemin Lee and Marek Šuppa and Crystina Zhang and Roberta Rocca and Mohammed Hamdy and Andrianos Michail and John Yang and Manuel Faysse and Aleksei Vatolin and Nandan Thakur and Manan Dey and Dipam Vasani and Pranjal Chitale and Simone Tedeschi and Nguyen Tai and Artem Snegirev and Michael Günther and Mengzhou Xia and Weijia Shi and Xing Han Lù and Jordan Clive and Gayatri Krishnakumar and Anna Maksimova and Silvan Wehrli and Maria Tikhonova and Henil Panchal and Aleksandr Abramov and Malte Ostendorff and Zheng Liu and Simon Clematide and Lester James Miranda and Alena Fenogenova and Guangyu Song and Ruqiya Bin Safi and Wen-Ding Li and Alessia Borghini and Federico Cassano and Hongjin Su and Jimmy Lin and Howard Yen and Lasse Hansen and Sara Hooker and Chenghao Xiao and Vaibhav Adlakha and Orion Weller and Siva Reddy and Niklas Muennighoff},
  publisher = {arXiv},
  journal={arXiv preprint arXiv:2502.13595},
  year={2025},
  url={https://arxiv.org/abs/2502.13595},
  doi = {10.48550/arXiv.2502.13595},
}

@article{muennighoff2022mteb,
  author = {Muennighoff, Niklas and Tazi, Nouamane and Magne, Loïc and Reimers, Nils},
  title = {MTEB: Massive Text Embedding Benchmark},
  publisher = {arXiv},
  journal={arXiv preprint arXiv:2210.07316},
  year = {2022}
  url = {https://arxiv.org/abs/2210.07316},
  doi = {10.48550/ARXIV.2210.07316},
}

Dataset Statistics

Dataset Statistics

The following code contains the descriptive statistics from the task. These can also be obtained using:

import mteb

task = mteb.get_task("Vidore3ComputerScienceOCRRetrieval")

desc_stats = task.metadata.descriptive_stats
{}

This dataset card was automatically generated using MTEB

Downloads last month
640

Papers for mteb/Vidore3ComputerScienceOCRRetrieval