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 in Python by Waseem
• 4,270 points
34 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 by Mohammad
• 3,060 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 5 days ago in Python by Noel Deepak Palle
69 views
0 votes
1 answer
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 in Python by Harsh
• 260 points
20 views
+3 votes
7 answers

How can I rename a file in Python?

yes, you can use "os.rename" for that. ...READ MORE

answered Mar 31, 2018 in Python by DareDev
• 6,810 points
115 views
+2 votes
2 answers

How can I create a new file in Python?

You can try the below code which ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,420 points
81 views
+2 votes
2 answers

Error while printing hello world in python.

You must be trying this command in ...READ MORE

answered Mar 31, 2018 in Python by GandalfDwhite
• 1,320 points
80 views
0 votes
1 answer

How can I compare the content of two files in Python?

Assuming that your file unique.txt just contains ...READ MORE

answered Apr 16, 2018 in Python by charlie_brown
• 7,720 points
73 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 in Python by Mohammad
• 3,060 points
46 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 in Python by Mohammad
• 3,060 points
33 views