PYTHON programming assignment
Suppose you are working at a lab and you have been asked to make a dictionary of raw data [of numbers and texts attached to each other]. The keys in the dictionary will be the texts, and the numbers are their values. Needs multiple line input.
Sample input:
2 electron1 gamma5 proton43 boson98 cat1 ray5 elec9 pion7
Sample output:
{'electron':1, 'gamma':5, 'proton':43, 'boson':98}
{'cat':1, 'ray':5, 'elec':9, 'pion':7}n = int(input())
for i in range(n):
result = {}
s = input()
for x in s.split(" "):
k = len(x)-1
number = ''
while(x[k].isdigit()):
number=x[k]+number
k = k - 1
result[x[:k+1]] = int(number)
print(result)



PYTHON programming assignment Suppose you are working at a lab and you have been asked to...
In Python In this programming assignment, you will do multiple programming exercises, and eventually develop a Python application that can calculate student course grades. (6 points) Write a program called p2-1.py to: (1) create a list and add integer numbers from 1 to 100 to the list; (2) calculate the average value of all numbers in the list; and (3) print the result (screenshots). (8 points) Write a program called p2-2.py to: (1) allow a user to define how many...
Could anyone please help with this Python code assignment? In this programming assignment you are to create a program called numstat.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The count of how many numbers are in the file. The average of the numbers. The average is the sum of the numbers divided by how many there are. The maximum value. The...
need help with python program
The objectives of this lab assignment are as follows: . Input data from user Perform several different calculations Implement conditional logic in loop • Implement logic in functions Output information to user Skills Required To properly complete this assignment, you will need to apply the following skills: . Read string input from the console and convert input to required numeric data-types Understand how to use the Python Modulo Operator Understand the if / elif /...
Python Question for My Programming Lab "You have a unique ID number, which is represented by the variable id, containing a string of numbers. Write a program that continuously takes strings to standard input. If the string is not your ID number, print "This is not your ID number." If it is, print "This is your ID number: " followed by the number, and terminate the loop." I have tried NEARLY ALL of the answers currently on Chegg for this...
In this assignment you are asked to write a Python program to determine all the prime numbers in between a range and store them in a list that will be printed when the range is searched. The user is prompted for two positive integer values as input, one is the start of the range and the other is the end of the range. If the user gives a negative value or enters a second number that is lower than the...
Could anyone help add to my python code? I now need to calculate the mean and median. In this programming assignment you are to extend the program you wrote for Number Stats to determine the median and mode of the numbers read from the file. You are to create a program called numstat2.py that reads a series of integer numbers from a file and determines and displays the following: The name of the file. The sum of the numbers. The...
JAVA Programming Assignment: You run four computer labs. Each lab contains computer stations that are numbered as shown in the table below:- Lab Number Computer Station Numbers 1 1-5 2 1-6 3 1-4 4 1-3 Each user has a unique five-digit ID Number. Whenever a user logs on, the user's ID, Lab Number, and the computer station are transmitted to your station. For example, if user 49193 logs onto station 2 in Lab 3, your system receives (49193, 2, 3)...
C++ Programming Assignment S Mammal Lab This lab's goal is to give you some practice using inheritance, virtual functions, pointers, dynamic memory allocation, random numbers, and polymorphism. To complete the lab implement the following steps: Create a class called Mammal. All mammals have a weight and a name, so its data should be the mammal's weight and name. Provide a default constructor that sets the mammal's weight to 0 and name to null, and another constructor that allows the weight...
In this lab you will convert lab5.py to use object oriented
programming techniques. The createList and checkList functions in
lab5.py become methods of the MagicList class, and the main
function of lab6.py calls methods of the MagicList class to let the
user play the guessing game.
A. (4pts) Use IDLE to create a lab6.py. Change the 2 comment
lines at the top of lab6.py file:
First line: your full name
Second line: a short description of what the program...
python program do not use dictionary, list only Complete the program found in assignment4.py. You may not change any provided code. You may only complete the sections labeled: #YOUR CODE HERE Write a program that does the following. Reads the contents of Text from the include file, input.txt Create a dictionary of key-value pairs called index.txt Key: This represents the individual word Value: This is a list of the line number from Text where Key appeared Example: If the word...