-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython_practice.py
More file actions
144 lines (117 loc) · 4.62 KB
/
Python_practice.py
File metadata and controls
144 lines (117 loc) · 4.62 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
from multiprocessing.sharedctypes import Value
from turtle import clear
print("hello world")
counties = ["arapahoe", "Denver", "Jefferson"]
if Counties [1]=='Denver':
Print(counties[1])
clear
counties = ["Arapahoe", "Denver", "Jefferson"]
if counties[1] == 'Denver':
Print(counties[1])
counties = ["Arapahoe", "Denver", "Jefferson"]
if counties[1] == 'Denver':
Print(counties[1])
counties = ["Arapahoe", "Denver", "Jefferson"]
if counties[1] == 'Denver':
print(counties[1])
counties = ["Arapahoe", "Denver", "Jefferson"]
if counties[1] == 'Denver':
print(counties[1])
counties = ["Arapahoe","Denver", "Jefferson"]
if counties[1] == 'Denver':
Print(counties[1])
counties = ["Arapahoe","Denver", "Jefferson"]
if counties[1] == 'Denver':
Print(counties[1])
if counties[3] !='Jefferson':
print(counties[2])
counties = ["Arapahoe", "Denver","Jefferson"]
if counties[1]=='Denver':
print(counties[1])
counties = ["Arapahoe", "Denver", "Jefferson"]
if counties[1] =='Denver':
print(counties[1])
counties = ["Arapahoe", "Denver", "Jefferson"]
if "El Paso" in counties:
print("El Paso is in the list of counties")
else:
print("El Paso is not the list of counties")
if "Arapahoe" in counties and "El Paso" in counties:
print("Arapahoe and El Paso are in the list of counties")
else:
print("Arapahoe or El Paso is not in the list of counties")
if "Arapahoe" in countes or "El Paso" in counties:
print("Arapahoe or el Paso is in the list of counties")
else:
print("Arapaahoe and El Paso are not in the list of counties")
if "Arapahoe" in counties and "El Paso" not in counties:
print("only Arapahoe is in the list of counties")
else:
print("Arapahoe is in the list of counties and El Paso is not in the list of counties")
for county in counties:
print(county)
for county in counties:
print(county)
for county in counties:
print("Arapahoe")
for county in counties:
print("Arapahoe", "Denver", "Jefferson")
numbers = [0, 1, 2, 3, 4]
for num in numbers:
print(num)
numbers = [0, 1, 2, 3, 4]
for num in numbers:
print(num)
for county in counties:
print(county)
for county in counties:
print("Arapahoe")
for num in range(5):
print(num)
for i in range(len(counties)):
print(counties[i])
for i in range(len(counties_tuples)):
print(counties_tuples[i])
for i in len(counties_tuples):
print(counties_tuples[i])
for i in range(len(counties_tuples)):
print(counties_tuples[i])
counties_dict = {"Arapahoe" : 422829, "Denver" : 463353, "jefferson": 432438}
for county in counties_dict:
print(county)
for county in counties_dict.keys():
print(county)
for voters in counties_dict.values():
print(voters)
for county, voters in counties_dict.items():
print(county, voters)
for county, voters in counties_dict.items():
print(county, voters)
voting_data = [{"county":"Arapahoe", "registered_voters" : 422829}, {"county": "Denver", "registered_voters": 463353}, {"County":"Jefferson", "registered_voters" : 432438}]
for county_dict in voting_data:
print(county_dict)
for county, voters in counties_dict.items():
print(county, voters)
for county_dict in voting_data:
print(county_dict['registered_voters'])
for county_dict in voting_data:
for value in county_dict.values():
print(value)
for county_dict in voting_data:
for value in county_dict.values():
print(value)
for county_dict in voting_data:
print(county_dict['county'])
counties_dict = {"Arapahoe": 369237, "Denver":413229, "Jefferson": 390222}
for county, voters in counties_dict.items():
print(county + " county has " + str(voters) + " registered voters.")
for county, voters in counties_dict.items():
print(f"{county} county has {voters} registered voters.")
message_to_candidate = (f"You received {candidate_votes:3345 ,} number of votes. "
f"The total number of votes in the election was {total_votes:23123,}. "
f"You received {candidate_votes / total_votes * 100:.2f}% of the total votes.")
message_to_candidate = (f"You received {candidate_votes:,} number of votes. "
f"The total number of votes in the election was {total_votes:,}. "
f"You received {candidate_votes / total_votes * 100:.2f}% of the total votes.")
counties_dict = {"Arapahoe": 422829, "Denver": 463353, "Jefferson": 432438}
voting_data = [{"county": "Araphoe", "registered_voters": 422829}, {"county":"Denver", "registered_voters": 463353}, {"county" :"Jefferson", "registered_voters" : 432438}]