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
125 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
3,587 views
0 votes
1 answer

I am making a ai in python but there is a error

Hi, @Rhydham, Try this: engine = pyttsx3.init('dummy') READ MORE

answered Oct 12 in Python by Gitika
• 50,980 points
124 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
161 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
127 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
• 78,520 points
104 views
0 votes
2 answers

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

there is sum() function as a built ...READ MORE

answered Oct 24 in Python by anonymous
10,413 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
253 views