Output of the code:
The given code is as follows:
#main function
def main():
#initialize the variable num as 0
num = 0
#call show_me function with argument num
show_me(num)
#function definition for show_me function
def show_me(arg):
#Display the given arg
print(arg)
#check if the arg is less than 10
if arg 10:
'''if arg is less than 10, then it calls show_me function
with arg is incremented with 1'''
show_me(arg + 1)
#call main function
main()
If the above code is executed, it produces the syntax error on the “if” statement that is highlighted on the code.
Syntax error:
An error that occurs on the source code of a program is referred as “syntax error” because the computer programs strictly follow the syntax rules; if the code fails to prove its
Want to see the full answer?
Check out a sample textbook solutionChapter 12 Solutions
Starting Out with Python (4th Edition)
- #include<stdio.h> #include<stdarg.h> void fun1(int num, ...); void fun2(int num, ...); int main() { fun1(1, "Apple", "Boys", "Cats", "Dogs"); fun2(2, 12, 13, 14); return 0; } void fun1(int num, ...) { char *str; va_list ptr; va_start(ptr, num); str = va_arg(ptr, char *); printf("%s ", str); } void fun2(int num, ...) { va_list ptr; va_start(ptr, num); num = va_arg(ptr, int); printf("%d", num); }.arrow_forward// SuperMarket.java - This program creates a report that lists weekly hours worked // by employees of a supermarket. The report lists total hours for // each day of one week. // Input: Interactive // Output: Report. import java.util.Scanner; public class SuperMarket { public static void main(String args[]) { // Declare variables. final String HEAD1 = "WEEKLY HOURS WORKED"; final String DAY_FOOTER = " Day Total "; // Leading spaces are intentional. final String SENTINEL = "done"; // Named constant for sentinel value. double hoursWorked = 0; // Current record hours. String hoursWorkedString = ""; // String version of hours String dayOfWeek; // Current record day of week. double hoursTotal = 0; // Hours total for a day. String prevDay = ""; // Previous day of week. boolean done = false; // loop control Scanner input = new…arrow_forwardInstructions: In Basic C Language In the code editor, you are provided with a main function that asks the user for an integer input and passes this value to a function called, getFactorial() The getFactorial() function has the following description: Return type - int Name - getFactorial Parameters - one integer Description - returns the factorial of the passed integer Your implementation should be RECURSIVE and you should not use any loops Input #include<stdio.h> int getFactorial(int); int main(void) { int n; printf("Enter n: "); scanf("%d", &n); printf("Factorial of %d is %d", n, getFactorial(n)); return 0;} int getFactorial(int n) { // TODO: Implement this recursive function} Output should be: Enter n: 3 Factorial of 3 is 6arrow_forward
- language c++arrow_forward(Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.arrow_forwardpointers as Arguments:In the C programming language there is no pass-by-reference syntax to passa variable by reference to a function. Instead a variable is passed by pointer(just to be confusing, sometimes passing by pointer is referred to as pass byreference). This Practice Program asks you to do the same thing as C.Here is the header for a function that takes as input a pointer to an integer:1. void addOne (int ∗ptrNum )Complete the function so it adds one to the integer referenced by ptrNum.Write a main function where an integer variable is defined, give it an initialvalue, call addOne, and output the variable. It should be incremented by 1.arrow_forward
- main.cpp 1 @include 2 using namespace std; int maxResult() 4-( int maxVal = 0; 6. for (int i = 0; i <= n; i += a) { for (int j = e; j <= n i;j += b) !! 10 (float)(n - (i + j)) / (float)(c); 11 float z = 12 if (floor (z) { int x = i / a; int y 13 ceil(z)) 14 15 16 j/ b; max (maxVal, x + y + (int)z); 17 maxVal = 18 19 20 21 22 return maxVal; 23 } 24 int main() 26 { 25 27 28 cout << maxResult( ); 29 30 return 0; 31 } Input Compilation failed due to following erors) main.cpp:7:23: error: 'n was not declared in this scope 7 for (int i = 0; i <= n; i t a) main.cpp:7:31: error: 'a' was not declared in this scope 7 for (int i 0; i <= n; i t a) main.cpp:9:36: error: 'b' was not declared in this scope for (int j = 0; j <- n i; j b) %3D main.cpp:11:45: error: was not declared in this scopearrow_forwardQuestion - 2) Create a C# Console application(DOT net framework) using Visual Studio IDE. Project name should include students' firstname(s) followed by A1(Example: HarleenHardeep_A1) (Submission Instruction: sumbit the Zipped project folder) In this project. Rename Program.cs to A1Q2.cs. In A1Q2.cs do the following tasks: Step 1 Declare variables of different data types (at least 10 variables). Assign valid literals to those variables. Step 2) Step 3) Print the values of the variables using format strings and placeholders in Console.Write() Console.WriteLine(). 2 | Page ASSIGNMENT 1 CSD 2354 (C#) Print values of some variables in following formats: i) Currency Number Hexadecimal, iv) Percentage. Embed comment lines before each Console.WriteLine and explain, how the format strings and placeholders work. Perform some arithmetic operations on the variables you declared in step 1. You should demonstrate the use of following arithmetic operations +,-,/, * and % Demonstrate the use of…arrow_forwardrefer to the statment below:arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT