The Error of this code is expected an intended block
kindly check and show the correct code
class AddColumn:
def add_column(str1,list1):
dict1[str1].append(list1)
x=AddColumn()
x.add_column( "City name",["Adelaide", "Brisbane", "Darwin", "Hobart", "Sydney", "Melbourne", "Perth"])
x.add_column("Area", [1295,5905, 112, 1357, 2058, 1566, 5386])
x.add_column("Population", [1158259, 18557594, 120900, 205556, 4336374, 3306092, 1554769])
x.add_column("Annual Rainfall"[600.5, 1146.4, 1714.7, 619.5, 1214.8, 646.9,869.4])
print(dict1)
The error of this code is Expected an indented block.
kindly check and show the correct code
main_list = []
x = {}
field_names = [ "City name", "Area", "Population", "Annual Rainfall"]
list1 = [
["Adelaide", 1295, 1158259, 600.5],
["Brisbane", 5905, 1857594, 1146.4],
[ "Darwin", 112, 120900, 1714.7],
["Hobart", 135, 20556, 619.5],
["Sydney", 2058, 4336374, 1214.8],
["Melbourne", 1566, 3806092, 646.9],
["Perth", 5386, 1554769, 869.4]
]
for i in range(0, len(list1)):
for key in field_names:
for value in list1[i]:
x[key] = value
list1[i].remove(value)
break
main_list.append(x)
print(main_list)
The problem with this code is No module named 'prettytable'
can you show the correct code?
table = PrettyTable()
table.field_names = ["pokemon name", "type"]
table.add_row(["pikachu", "Electric"])
table.add_row(["sydney", "Dark"])
table.add_row(["charmander", "Fire"])
table.add_row(["squite", "Water"])
print(table)
Program that will accept number of students and number of quizzes of students. Program will accept the name of the student and the quiz grades of the student. The input will be stored to a dictionary. The name of the student will be the key and the quizzes will be the value in list format (e.g., {“Jose S. Uy”: [87,90,97,80,95], “Rowena M. Evangelista”: [88,87,90,97,83].
The program will output the list of quizzes per student, the lowest quiz, the highest quiz, and the average quiz grade.
EXAMPLE:
number of students: 2
number of quizzes: 5
student 1: Jose S. Uy
quiz 1: 87
quiz 2: 90
quiz 3: 97
quiz 4: 80
quiz 5: 95
student 2: Rowena M. Evangelista
quiz 1: 88
quiz 2: 87
quiz 3: 90
quiz 4: 97
quiz 5: 83
Quiz Result:
Student 1: Jose S. Uy
Quizzes: [87, 90, 97, 80, 95]
Lowest: 80
Highest: 97
Average: 89.8
Student 2: Rowena M. Evangelista
Quizzes: [88, 87, 90, 97, 83]
Lowest: 83
Highest: 97
Average: 89
Write a program to write info from a txt. file. You are to create a file that writes the text from your file and puts "*" on either side of your text. The number of stars on each side is to equal the line number from the text you read. ie. line 10 has 10 stars on either side - **********Introducing*********. Your file is to end when the program reads EXIT.
a) Write a program that reads a string as input from the user. Implement defensive programming so that the string is not empty.
b) Then, print the string after removing the character in position N (1 up to the length of the string) that will be indicated by the user. Implement defensive programming so that the position indicated by the user is valid.
c) Finally, ask the user for a character and return the number and percentage of appearances of that character in the original string.
We assume that one machine offers four different types of drinks (coffee, coffee with milk, chocolate and chocolate with milk), which cost € 1.50, € 1.80, € 2.10 and € 2.40 respectively. The machine accepts 10, 20 and 50 cent coins, one (1) euro and two (2) euro coins, as well as € 5 and € 10 banknotes, and returns change using only coins. To implement a program, which:
a) To display a selection list (menu) of the offered items (numbered from 1 to 4) with the corresponding price for each, the option 0 to exit the program and then reads the user's choice (preferred item or exit), applying defensive programming to ensure that the user enters a value between 0 and 4.
Create a Python program to rename the Excel spreadsheets (found in the folder attached to this assignment) to add SCC in front of each file name. Save the newly named files in a new directory.
I can put the link in there for it
by CodeChum Admin
Instructions:
Input
The first line contains an integer n which is the size of the array.
The next n lines contains a string on each.
The last line contains an integer which is the index to be accessed and printed.
6
Learning
Programming
made
easy
with
Cody!
5
Output
A line containing a string.
Cody!
by CodeChum Admin
Instructions:
Input
Two lines containing a string.
fun
Python
Output
A line containing a string.
Python is really fun