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
786 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,230 points

Related Questions In Python

0 votes
1 answer

Why am I getting the syntax error SyntaxError invalid syntax in a line that contains fully valid syntax?

A "SyntaxError: invalid syntax" is a common ...READ MORE

answered Oct 18, 2023 in Python by anonymous
• 3,320 points
695 views
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 20, 2019 in Python by Noel Deepak Palle
5,511 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') If you want ...READ MORE

answered Oct 12, 2020 in Python by Gitika
• 65,910 points

edited Aug 11, 2021 by Soumya 2,923 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
685 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 25, 2020 in Python by anonymous
23,265 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,230 points
926 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP