-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinto_to_python_notes
More file actions
58 lines (45 loc) · 1.44 KB
/
into_to_python_notes
File metadata and controls
58 lines (45 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
while loop
while(True):
entry = input(Enter number or 'x' to quit: ")
if entry == 'x':
break
num = float(entry)
whenever you write a program, write it piece by and piece and test it
if you want to skip a line in output you would type and additional print() function before your print function so the presentation of output is presentable
if you wrap your or's with parenthesis then indentation shouldnt matter
"""
Write a while loop to count the number of consonants in the string
"Computer". (hint: check while not vowel)
"""
# =============================================================================
# word = "Computer"
# count = 0
# total = 0 #how many consonants
#
# while count < len(word):
# if (word[count] != 'a' or
# word[count] != 'e' or
# word[count] != 'i' or
# word[count] != 'o' or
# word[count] != 'u'):
# total = total + 1
# count = count + 1
#
# print()
# print(f"{total}")
# =============================================================================
word = "Computer"
count = 0
total = 0 #how many consonants
while count < len(word):
if word[count] not in ['a', 'e', 'i', 'o', 'u']:
total = total + 1
count = count + 1
print()
print(f"{total}")
#we want to print three rows of % with 6 columns, the problem right now is that when j reaches 6 it meets the condition
i = 1
while i <= 3:
print("%", end='')
i = i + 1
while j <= 6: