syntaxerror-invalid-syntax-I don't know why it pops up.

Asked 2 years ago, Updated 2 years ago, 47 views

This is after installing Python 3 and Atom and Miniconda.

An error occurs when I run the Celsius converter program in cmd after writing a function in atom.

Is there a problem with the function I wrote?

3/31 12:41 Correction

def input_celsius_value():
    celsius_value = float("This program converts seob to Fahrenheit")
    print(celsius_value)
    #----------------------------------------
    result = float(celsius_value)

def convert_celsius_fahrenheit():
    fahrenheit_value = float((9 / 5) * celsius_value) + 32)
    #----------------------------
    result = fahrenheit_value

def print_fahrenheit_value():
    print(celsius_value : , fahrenheit_value :)

    #-------------------------------- 

3/31 12:42

D:\workspace\mooc_python_labs\lab_4>python fahrenheit_converter.py File "fahrenheit_converter.py", line 4 celsius_value = float("This program converts seob to Fahrenheit" :)) ^ SyntaxError: invalid syntax

error python

2022-09-22 10:18

2 Answers

When you write a code, it doesn't work if you make a mistake with even one small thing.

Check out how to create a function in Python again.


2022-09-22 10:18

Please correct the colon and brackets.


2022-09-22 10:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.