Why am I getting a error when I am printing two different data types in python?

0 votes
i have two variables.

x = 100

y = 'sum is'

print( y + x)
Mar 6, 2019 in Python by Waseem
• 4,540 points
98 views

1 answer to this question.

0 votes
different data type is being used. that is why you are getting the error.

try writing

y + str(x)

this would not give you the type error.
answered Mar 6, 2019 by Mohammad
• 3,210 points

Related Questions In Python

0 votes
1 answer

i am normalizing the data set iris in python and get the error ::TypeError: 'numpy.float64' object is not callable

TRY THIS   #Nomalisation for i in names:     print(i)   ...READ MORE

answered Aug 19, 2019 in Python by Noel Deepak Palle
2,433 views
0 votes
1 answer

how do i print only the last two letters in a string using regular expression in python?

$ to match the end of the ...READ MORE

answered Mar 15, 2019 in Python by Waseem
• 4,540 points
122 views
0 votes
1 answer

What are the different types of data types one can use in Python?

Python provides an array of built-in constants, ...READ MORE

answered May 28, 2019 in Python by Harsh
• 260 points
85 views
+1 vote
1 answer
0 votes
1 answer

How do I merge two dictionaries in a single expression in Python?

Hello, For dictionaries x and y, z becomes a shallowly merged dictionary with ...READ MORE

answered Apr 13 in Python by Niroj
• 42,600 points
51 views
0 votes
1 answer

I was written the python program, am getting error message "IndentationError: expected an indented block"

Hi@Thiyagarajan, You have one else block in your ...READ MORE

answered May 27 in Python by MD
• 41,020 points
632 views
0 votes
1 answer

How can I write a program to add two numbers using functions in python?

def add(a,b):      return a + b #when i call ...READ MORE

answered May 20, 2019 in Python by Mohammad
• 3,210 points
6,288 views
0 votes
1 answer

how do I check the length of an array in a python program?

lets say we have a list mylist = ...READ MORE

answered Mar 12, 2019 in Python by Mohammad
• 3,210 points
192 views