Python Forum
I want to multiply two variables, but I get an error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I want to multiply two variables, but I get an error
#3
Thanks for the smiley

Using f strings for the print statements
name = 'Random'
height = 1.65
weight = 52
bmi = weight / (height * height)
print(f'Name: {name}\nBMI: {bmi}')
if bmi < 25:
    print(f'{name} is underweight')
elif bmi > 25:
    print(f'{name} is overweight')
elif bmi == 25:
    print(f'{name} is normal-weight')
Reply


Messages In This Thread
RE: I want to multiply two variables, but I get an error - by Yoriz - Aug-09-2020, 03:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Getting error trying to use functions to multiply numbers rrowhe4d 5 1,968 Aug-30-2021, 07:11 AM
Last Post: Yoriz
  Error : "can't multiply sequence by non-int of type 'float' " Ala 3 3,145 Apr-13-2021, 10:33 AM
Last Post: deanhystad
  error with variables 3.8 jusrosetyler1123 3 2,235 Dec-18-2019, 03:16 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020