Why isn't the while-loop working in Python? [closed] - python

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I tried a basic while-loop in Python 3.8 but I always get a syntax error. Anybody know why?
I tried Notepad++ but when I write the loop, Python doesn't run

i = 1
while i <= 5:
print(i)
i += 1
This works in PyCharm, looking at the image it seems that you wrote the if statement
and the print() on the same line. Which also gave me an error.

Related

why does my console show nothing in pyhon? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 months ago.
Improve this question
This is my coding
below one is the screenshot of the lecture
I would like to know why my console does not show anything, unlike the lecture.
I can't tell from the photos but it looks like you're not calling the function? and if you are, maybe with the wrong parameters, can you upload all of your code?

Python for loop and if control [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 months ago.
Improve this question
Greetings, I'm trying to make a user login using a for loop, but when I use and in the if block I use to cancel the operation, even if I don't enter 0, the process ends, but when I use or it doesn't work, why?
Number 3 and string '3' are not equal
example

time is not defined Python [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I am trying to understand python time (mainly so I can get the program to wait). When I run these 3 lines:
while True:
time.sleep(1)
print("BREAK")
I get the error:
NameError: name 'time' is not defined
What is the problem?
simply type import time before your code, this will fix the problem.

Python if/else/elif always goes to else [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I'm creating a program for a school assignment that uses python to give basic info on elements on the periodic table. I'm using if/elif/else and print in order to do this. After I got all the if/elif/else statements down I went to test it, and when I type anything in it goes to the else condition, even if I type in something that should go to an elif statement. Code is too long to paste here so I put it in a document here Python version is 3.6.4
I wonder how you are able to run this program, seems to be some harry potter stuff. For me its typo in this line "ele" == input("") and gives Syntax error . So just fix this with ele = input() and replace "ele" with ele in all if/elif checks i.e if ele == "H":it will work as intended.

Printing special characters in Python [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I am a beginner Python programmer and I wanted to use this character: █. I have tried just doing: print "█" but I always got an error. I Have looked for solutions, but have found nothing that helped me.
You can print any unicode symbol by using the \uxxxx notation. For instance, 2588 is a code for unicode block.
print('\u2588')

Categories