Question

Question2 1.5 points Save Answen Find the output of the following python code a-10 b15 a-a+b print b Path:p Words:0
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

a=10 /* a is initialized by 10 */
b=15 /* b is initialized by 15 */
a=a+b /* The contents of a and b are added and the result is stored in a (a=10+15==>a=25) */
print b /* print b is invalid syntax. Instead of writing print b, we shold write it as print (b) */

The program shows syntax error at print b (The syntax error is Invalid syntax)

if the question is as follows

a=10
b=15
a=a+b
print (b) /* prints b value (that is 15) */

Add a comment
Know the answer?
Add Answer to:
Question2 1.5 points Save Answen Find the output of the following python code a-10 b15 a-a+b...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1 Show the output from the following Python code fragment: for i in [ 12, 4,...

    1 Show the output from the following Python code fragment: for i in [ 12, 4, -2]:      print (2 * i) 2 Write a Python program findAverage to find the average of the numbers in a range defined by two inputs num1 and num2, where the values of num1 and num2 are entered by the user. For example, a call to findAverage(2,10) would find the average of the numbers 2,3,4,5,6,7,8,9 (note the final "10" is NOT included!). The output...

  • What is the output of the following Python code if the user enters 4? count =...

    What is the output of the following Python code if the user enters 4? count = int(input()) the_sum = 0 for i in range (1, count):     the_sum = the_sum + i print("Sum is", the_sum)

  • Python   #complete the following lines of code wherever indicated. 5 question 20 points a piece #you...

    Python   #complete the following lines of code wherever indicated. 5 question 20 points a piece #you may use your book and internet but no form of messaging or communication #QUESTION 1 #Read in the file exam_file.txt #Print to the console every other line #QUESTION 2 #Read in exam_file.txt #split file into words #write to a file called question2.out that contains 1 word per line (words can occur more than once) #QUESTION 3 # Print out all the Middle Initials in...

  • Python #complete the following lines of code wherever indicated. 5 question 20 points a piece #you...

    Python #complete the following lines of code wherever indicated. 5 question 20 points a piece #you may use your book and internet but no form of messaging or communication #QUESTION 1 #Read in the file exam_file.txt #Print to the console every other line #QUESTION 2 #Read in exam_file.txt #split file into words #write to a file called question2.out that contains 1 word per line (words can occur more than once) #QUESTION 3 # Print out all the Middle Initials in...

  • python question! points) Attached to the Exam #4 code Assignment in Tracs you ## will find...

    python question! points) Attached to the Exam #4 code Assignment in Tracs you ## will find a file, "text.txt". Text is stored 1 sentence per line. ## Write a program below that reads the file contents and displays ## the following: ## 1. Number of uppercase characters in the file ## 2. Number of lowercase characters in the file ## 3. Number of digits in the file. ## 4. Number of whitespace characters in the file ## ## print("Number of...

  • in C++ Path: P Words:0 QUESTION 29 Write the code that allows you to input one...

    in C++ Path: P Words:0 QUESTION 29 Write the code that allows you to input one number and print whether it is even or odd. Include variable declarations. Your variable should be your first name. You will lose points for a different variable name. TTTT Paragraph • Arial • 3 (12pt) %0DQ TT, Of Mashups HTML CSS Path:p Words: 0 Click Save and Submit to save and submit. Click Save All Answers to all misters Sa

  • IN PYTHON: The following code contains syntax errors. Assuming the code should read in a name,...

    IN PYTHON: The following code contains syntax errors. Assuming the code should read in a name, and output a message indicating if the last name is "Smith". REWRITE THIS STATEMENT CORRECTLY. value = input(" enter your name using LAST, FIRST format") val= value.split(",") if value[0] ="Smith": print("your last name is common") else val[0] != "Smith": print("not so common") print(]"ODD")

  • given code: assignment: use python to extend the given code to create an output similar to...

    given code: assignment: use python to extend the given code to create an output similar to the one in the black box please explain the final code import random HALMst N in = int(input('Enter Total Number of Cards: ") NM in NOON A = [] B [] E - [] D = [] E = [] for i in range(1, n+1): A.append(i) D.append(i) E.append(i) for j in range(n): 8.append(random.choice(D)) D.remove(B[5]) C.append(random.choice(E)) E.remove(C[j]) c= 0 for k in range(n): if (Brkl...cikl):...

  • Python Modify the following code by only adding end and sep options to the existing print...

    Python Modify the following code by only adding end and sep options to the existing print commands to get the output A.B;C:E-- Here is the code to modify: print("A","B") print("C") print("E")

  • Question 17 (3 points) Predict the output of the following code segment: a = 99.98 if...

    Question 17 (3 points) Predict the output of the following code segment: a = 99.98 if a + 0.01 >= 100: print('A') elif a + 0.02 >= 100: print('B') print('c') else: print('D') print('E') Question 16 (3 points) Predict the output of the following code segment: X = 6 if x % 2 == 0: print ("x is even.") else: print ("x is odd.") Please use the decimal point to distinguish int and float. For example, number 3 + number 4...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT