Forum Discussion

Dicken's avatar
Dicken
Icon for Post Prodigy rankPost Prodigy
7 days ago
Solved

pasting code

I have just asked a question, and used the code tags, as you would for 'forum',  but on viewing it does not look very 
copy / paste friendly, which was the point of  sharing, is there a better way or is there a way to view the entire code
as it would appear in a formatter,   not much point iin formatting before posting if it's just going to be converted to a single long line 

 

Richard

3 Replies

  • Hi Dicken​,

    This has been fixed now. 

     See sample code below

    # Ask the user for their name
    name = input("Enter your name: ")
    
    # Ask for numbers (and convert the text input into floating-point numbers)
    num1 = float(input("Enter first number: "))
    num2 = float(input("Enter second number: "))
    
    # Perform basic math
    total_sum = num1 + num2
    
    # Print the results using an f-string (formatted string literal)
    print(f"Hello, {name}!")
    print(f"The sum of {num1} and {num2} is {total_sum}")

     

    • Dicken's avatar
      Dicken
      Icon for Post Prodigy rankPost Prodigy

      well at least it's not just me.