53.7k views
0 votes
Which of the following expressions would produce an error in python? a. print( "one"+"2" )

b. print( 3 + 4 )
c. print( "7" + 'eight' )
d. print( '5' + 6 )

User David Rice
by
5.9k points

1 Answer

3 votes

Answer:

c. print( "7" + 'eight' )

Step-by-step explanation:

From the options listed in the question the only one that would produce an error would be option c. print( "7" + 'eight' ). This is because the second element being added is a string that says eight but it is being represented as a char variable. The ' ' is only used for single-digit character variables while the " " is used for words or strings of characters like the word eight. In this piece of code the system will try to read this as a Char variable but will detect more than one char and produce an error.

User Suhel
by
7.3k points