Python Forum
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Math problem python
#1
# Set count_to equal to the sum of two big numbers
addition =  72 + 23
substration = 108 - 204
multiplaction = 108 * 0.5
division = 108 / 9
if(addition< substration)
x = mul <= div
x = true
else 
x = div < mul
x = false 

if x = true 
print count = true 
else 
print count = false 

count_to = addition + multiplaction
print count_to
Error:
File "python", line 6 if(addition< substration) ^ SyntaxError: invalid syntax
Reply
#2
You have missed the colon in the if statement. Fix your indentation
This doesn't make sense:
x = mul <= div
This one too:
x = div < mul
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to do "fixed size" (wrapping) math in Python? AlexanderWulf 13 1,869 Jul-19-2023, 04:13 PM
Last Post: deanhystad
  math problem for experts miltmobley 5 998 Jul-09-2023, 07:14 AM
Last Post: Gribouillis
  Math python question Deonvek 6 1,151 Apr-05-2023, 09:27 PM
Last Post: deanhystad
  math.log versus math.log10 stevendaprano 10 2,418 May-23-2022, 08:59 PM
Last Post: jefsummers
  Math Package in python Uma 1 1,493 Dec-12-2021, 02:01 PM
Last Post: jefsummers
  Why getting ValueError : Math domain error in trig. function, math.asin() ? jahuja73 3 3,771 Feb-24-2021, 05:09 PM
Last Post: bowlofred
  "SyntaxError: invalid syntax" running code in Doing Math With Python b saucerdesigner 2 2,737 Nov-03-2020, 04:23 PM
Last Post: saucerdesigner
  Programming Difficult math in Python Huntern 6 4,758 Oct-17-2019, 06:32 AM
Last Post: Huntern
  python 3 math formulas where to use () Python101 1 2,306 Jun-09-2019, 09:54 PM
Last Post: micseydel
  Python modeling a math solution Masterwoot 1 2,257 Mar-01-2019, 08:50 AM
Last Post: buran

Forum Jump:

User Panel Messages

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