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_forwardConsider the following pseudo code, Method func() { PRINT “This is recursive function" func() } Method main( { func() } What will happen when the above snippet is executed?arrow_forward
- Static Variable: a variable whose lifetime is the lifetime of the program (static int x;) Dynamic Variable: It is a pointer to a variable (int *x;) Is this comparison true?arrow_forwardlanguage 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_forward
- def SomeMethod(a,b): a= a+b b=b+a print(a,b,end=" ") return (a+b) def main(): x=10 y=20 print(SomeMethod(x,y)) main() x and y are called: ? a and b are called: ?arrow_forward3. Show the stack with all activation record instances, including static and dynamic chains, when execution reaches position 1 in the following skeletal program. Assume bigsub is at level 1. function bigsub() { function a(flag) { function b() { *** a(false); } // end of b *** *** if (flag) b(); else c(); } // end of a function c() { function d() { <--- *** } // end of d d(); } // end of c *** 2 a(true); } // end of bigsub The calling sequence for this program for execution to reach dis bigsub calls a a calls b 12arrow_forwardConvert to C# Language def Deposit(balance, pin): # Deposit function p = int(input("Enter the PIN: ")) # taking PIN from user if p == pin: # if PIN matches with actual PIN amount = float(input("Enter deposit amount: ")) # taking deposit amount from user balance += amount # adding deposit amount to balance else: # else (if PIN not matches) print("Incorrect PIN!!") # display message return balance # return balance def Withdraw(balance, pin): # Withdraw function p = int(input("Enter the PIN: ")) # taking PIN from user if p == pin: # if PIN matches with actual PIN amount = float(input("Enter withdraw amount: ")) # taking withdrawal amount from user if amount > balance:…arrow_forward
- //Assignment 06 */public static void main[](String[] args) { String pass= "ICS 111"; System.out.printIn(valPassword(pass));} /* public static boolean valPassword(String password){ if(password.length() > 6) { if(checkPass(password) { return true; } else { return false; } }else System.out.print("Too small"); return false;} public static boolean checkPass (String password){ boolean hasNum=false; boolean hasCap = false; boolean hasLow = false; char c; for(int i = 0; i < password.length(); i++) { c = password.charAt(1); if(Character.isDigit(c)); { hasNum = true; } else if(Character.isUpperCase(c)) { hasCap = true; } else if(Character.isLowerCase(c)) { hasLow = true; } } return true; { return false; } }arrow_forwardmain.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_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