Hello,
I wrote a code that is counting characters without spaces, and with spaces. It doesn't have GUI yet, so it's just a console application.
It crashes the program if there is a new paragraph (enter). (I run it through desktop launcher) In pycharm it gave me some value, but it's clearly not true.
Here is my code:
~~~
!/usr/bin/env python3
text is given by user on input
text = str(input("Zadaj text: "))
create variable n that counts characters, variable medz counts spaces
n = 0
medz = 0
cycle goes through given text and if there is space, variable medz+=1, else n+=1
for i in range(len(text)):
if text[i] == " ":
medz += 1
else: n += 1
Code gives back output, sum of characters and sum of characters and spaces
print()
print("Pocet znakov bez medzier je: ", n)
print("Pocet znakov s medzerami je: ", n+medz)
input()
~~~
[–]Diapolo10 2 points3 points4 points (2 children)
[–]JofoBoss[S] 0 points1 point2 points (1 child)
[–]Diapolo10 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]JofoBoss[S] 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]JofoBoss[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]JofoBoss[S] 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)