How do I change string values in a variable?

example:
string = 'Hello'
print(string)
change string to 'Bye' <-- How do I do that?
print(string)

Recommended Answers

Well, the OP tagged the article with PYTHON so I kinda wonder why you posted php code.

Jump to Post

All 4 Replies

string = 'Hello'
print(string)
string = 'Bye'
print(string)

@Grib. Are you sure about that? phpfiddle said:

FOUND 3 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
 2 | ERROR | Missing file doc comment
 2 | ERROR | Constants must be uppercase; expected STRING but found string
 4 | ERROR | Constants must be uppercase; expected STRING but found string
--------

`

commented: @grib is right. You can't run python on php fiddle +0

Well, the OP tagged the article with PYTHON so I kinda wonder why you posted php code.

commented: Mhissed that. Had PHP on the brain today. +7
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.