KnowledgeBoat Logo
|

Computer Science

Record what happens when the following statements are executed:

(a) print (n=17)

(b) print (8 + 9)

(c) print (4.2, "hello", 6 - 2, "world", 15/2.0)

(d) print ("123abc", sep = '-')

(e) print ("XXX", end ='!')

Getting Started

2 Likes

Answer

(a) print(n=17) — It raises an error because the syntax print(n=17) is incorrect. In this context, n=17 is trying to use an argument name assignment within the print() function, which is not valid.

(b) print(8 + 9) — 17

(c) print(4.2, "hello", 6 - 2, "world", 15/2.0) — 4.2 hello 4 world 7.5

(d) print("123abc", sep = '-') — 123abc

(e) print("XXX", end ='!') — XXX!

Answered By

2 Likes


Related Questions