python TypeError: can’t multiply sequence by non-int of type ‘float’

 

This error shows up when there is a type mismatch.

Example:

When you execute below code you will get this error-
 

>> hrs = input(“Enter Hours:”)
Enter Hours:40
>>> rate =float( input(“Enter Rate”))
enter rate: 10
>>> pay = hrs*rate
TypeError: can’t multiply sequence by non-int of type ‘float’

 

Solution for this:

hrs = float(input(“Enter Hours:”))
rate = float(input(“enter rate”))
pay = hrs*rate
print(‘Pay:’ , pay)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s