I need a line of code that executes print(personal_data) after input(personal_data). Can someone help me?
Hello,
I'm currently learning Python and I'm stuck:
I have already tried :
if input(personal_data) then print(personal data)
But it doesn't work because "then" isn't recognized. Please help me!
Sure. There is no keyword “then” in Python. That’s right:
https://docs.python.org/3/tutorial/controlflow.html#if-statements
What do you expect? Here it would be checked whether input returns something other than an empty string (or none). I can make sense, but I don’t know if you want to. Since the result is not used, the input is at any rate lost – input() takes as parameter a prompt (i.e. a text that is displayed before the input). It cannot change the content of the variable.
The double point after that, of course, is missing.
And that’s completely different code. You should describe what your goal is.
Your syntax is wrong
At Python you have to press in and at the if I think instead of then put a double point.
I’ll give you another Python code with ‘if’.
Use Python extremely rare, therefore my uncertainty
b should be a.
Again:
At Python MUSST you move in. Here the print-statement
should be clear that this does not work, because the Input function as a criterion for a condition does not show much.
By the way:
personal_data is a Tuple. Then why do you know the associated values without brackets?
Without clips, it also works with me
may not be. input() returns strings. An empty string would be “falsy”, i.e. the condition would not be fulfilled.
A tuple becomes not determined by clamps, but by communication-separated values. This, for example, is a tuple with an element: