Programming

Programming questions? Ask a programmer for answers ASAP

Ask a Computer Expert,
Get an Answer ASAP!

This answer was rated:

VWorker01.pyw import sys; print (sys.version) n = 4; m = 2 M…

VWorker01.pyw import sys; print (sys.version) n...

VWorker01.pyw
import sys; print (sys.version)
n = 4; m = 2
M = n * [n * [0.0]]
print("show M contents: ")
print (M)
for i in iter(range(m,n)):
M[i][i] = 1.0
print ("show M contents: ")
print(M)# For context, the code above represents a step, not the last step,
# in building a matrix that I will use extensively later on.
# The matrix I want is
# [[0.0,0.0,0.0,0.0], [0.0,0.0,0.0,0.0], [0.0,0.0,1.0,0.0], [0.0,0.0,0.0,1.0]] .
# More genereally, I want a matrix that is all 0.0 except the diagonal in the
# lower-right quadrant should be 1.0 . The lower right quadrant is defined as
# Rows and columns greater than m.
#
# The code above is very wrong since it produces
# [[0.0,0.0,1.0,1.0], [0.0,0.0,1.0,1.0], [0.0,0.0,1.0,1.0], [0.0,0.0,1.0,1.0]] .
# The unix Script Output.log is shown below:
# ================================================================================
# Jan 13, 2018 at 3:46:44 PM
# ~/Desktop/LA/vWorker01.py
# --------------------------------------------------------------------------------
# 3.6.3

Anaconda, Inc.

(default, Oct 6 2017, 12:04:38)
# [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
# show M contents:
# [[0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0], [0.0, 0.0, 0.0, 0.0]]
# show M contents:
# [[0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0]]I ask for two things:
1) Correct code that produces the matrix I want. The styl preferred is simple,
readable code, not something that shows deep and subtle Python knowledge.
The code should not require NumPy which may not be available everywhere that the
program might be run.
2) An explanation of why the correct code succeeds and why my code fails.

Technician's Assistant: Have you begun working on a solution? What Python code do you have so far?

What I have so far is at the top of my message. The message will run as a Python script.

Technician's Assistant: The Programmer will be able to walk you through that. What are the full requirements for this task? How soon do you need it completed?

The requirements are in the message as comments to the program. I don't have a strict deadline. I suspect hat a well-qualified programmer (better qualified than I am, for sure) could answer in a short time.

Show More
Show Less
Ask Your Own Programming Question
Answered in 2 hours by:
1/13/2018
George Sibiya
George Sibiya, Computer Hardware Engineer
Category: Programming
Satisfied Customers: 367
Experience: PhD in Computer Science
Verified

Hi,

Welcome to JustAnswer and thank you for utilising our services

I am working on you task and will post back

Regards,

G

Ask Your Own Programming Question

You can get from here and the explanation is included

George Sibiya
George Sibiya, Computer Hardware Engineer
Category: Programming
Satisfied Customers: 367
Experience: PhD in Computer Science
Verified
George Sibiya and 87 other Programming Specialists are ready to help you
Ask your own question now
Was this answer helpful?

How JustAnswer works

step-image
Describe your issueThe assistant will guide you
step-image
Chat 1:1 with a programmerLicensed Experts are available 24/7
step-image
100% satisfaction guaranteeGet all the answers you need
Ask George Sibiya Your Own Question
George Sibiya
George Sibiya
George Sibiya, Computer Hardware Engineer
Category: Programming
Satisfied Customers: 367
367 Satisfied Customers
Experience: PhD in Computer Science

George Sibiya is online now

A new question is answered every 9 seconds

How JustAnswer works:

  • Ask an ExpertExperts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional AnswerVia email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction GuaranteeRate the answer you receive.

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed.

One Happy CustomerNew York

Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help.

Mary C.Freshfield, Liverpool, UK

This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!!

AlexLos Angeles, CA

Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult.

GPHesperia, CA

I couldn't be more satisfied! This is the site I will always come to when I need a second opinion.

JustinKernersville, NC

Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around.

EstherWoodstock, NY

Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know.

RobinElkton, Maryland

< Previous | Next >

Meet the Experts:

ATLPROG

ATLPROG

Computer Software Engineer

7,677 satisfied customers

MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

LogicPro

LogicPro

Computer Software Engineer

7,175 satisfied customers

Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.

unvadim

unvadim

Computer Software Engineer

1,168 satisfied customers

Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

lifesaver

lifesaver

Computer Software Engineer

950 satisfied customers

Several years of intensive programming and application development experience in various platforms.

ehabtutor

ehabtutor

Computer Software Engineer

936 satisfied customers

Bachelor of computer science, 5+ years experience in software development, software company owner

TheDoctor

TheDoctor

Software Engineer

893 satisfied customers

M.S. in Internet Information Systems

The-PC-Guy

The-PC-Guy

Software Engineer

848 satisfied customers

Extensive Knowledge in PHP, MYSQL, CSS & Javascript

< Previous | Next >

Related Programming Questions
Thank you! I had some questions with a python program, I'm
Thank you! I had some questions with a python program … read more
LogicPro
LogicPro
Computer Software Engineer
Bachelor of Technology
7,175 satisfied customers
Use ImageMagick to make multi-photo for eBay gallery
I use Python to list my items. I'm selling shirts with 12 different designs for each listing. I would like to create a script using Python ImageMagick or equivalent to tile those designs into a good e… read more
Arty
Arty
Senior Administrator
Bachelor\u0027s Degree
469 satisfied customers
Hi, I m first year to learn python and not really get used
Hi, I m first year to learn python and not really get used to it. I am kind of struggling work on the first assignment. Any help will be appreciated. Thanks Heres the questions. http://ilearn.mq.edu.a… read more
unvadim
unvadim
Computer Software Engineer
Diplom
1,168 satisfied customers
I wrote a 60 line simple QBASIC sample program that serves
I wrote a 60 line simple QBASIC sample program that serves as a menu using commands like LOCATE, GOSUB, PRINT, INPUT, IF, etc. I'd like to have this exact* program translated into Python using the cur… read more
Zabo04
Zabo04
Master\u0027s Student
Master\u0027s Degree
7 satisfied customers
Having a problem with my bigcommerce site. My developer put
Having a problem with my bigcommerce site. My developer put in this accordion functionality on our design+services page. When I have the site marked as "down for maintenance" and I look at that page a… read more
Brandon M.
Brandon M.
System Administrator
Vocational, Technical or Trade Scho
2,143 satisfied customers
Hi Tony, I am a fairly new to python. I have tons of files
Hi Tony, I am a fairly new to python. I have tons of files that I use a s GIS analyst that I want to examine - change their name, check file size, counts, etc.. To get started I am looking for some he… read more
Brandon M.
Brandon M.
System Administrator
Vocational, Technical or Trade Scho
2,143 satisfied customers
Q1. Choose a number. Find the order of the number, to find
Q1. Choose a number. Find the order of the number, to find this: If the number is XXXXX you halve it. If the number is XXXXX you multiply it by three and add 1. continue to do this until the number re… read more
Ingo U
Ingo U
Master\u0027s Degree
358 satisfied customers
MATLAB I need help in MATLAB with for loops, while loops,
MATLAB I need help in MATLAB with for loops, while loops, and functions. I have two questions I am confused about and need help with. I need help with these questions and to be completed in the next 4… read more
Steven Caliendo
Steven Caliendo
Vocational, Technical or Trade Scho
99 satisfied customers
Practice using the Python interpreter as a calculator: 1.
Practice using the Python interpreter as a calculator: 1. The volume of a sphere with radius r is 4/3 πr^3. What is the volume of a sphere with radius 5? Hint: 392.6 is wrong!… read more
ATLPROG
ATLPROG
Computer Software Engineer
Master's Degree
7,677 satisfied customers
I am using the following sql SELECT CONVERT(varchar,
I am using the following sql: SELECT CONVERT(varchar, ClinicalDate, 101) AS Date, StudentName, TotalHours AS Hours, StartTime, EndTime, Name, CostCenter, EVENT_ID, SECTION, PreceptorId FROM (SELECT St… read more
ehabtutor
ehabtutor
Computer Software Engineer
Bachelor's Degree
936 satisfied customers
Create a class called DateProfile that has the following private
Create a class called DateProfile that has the following private instance members: gender - a char, the gender of the applicant ('M' or 'F'). search_gender - a char, the gender of desired partner ('M'… read more
unvadim
unvadim
Computer Software Engineer
Diplom
1,168 satisfied customers
Teacher added to the project. 1. Write a script that inputs
Teacher added to the project. 1. Write a script that inputs a line of plain text and a distance value and outputs an encrypted text using a Caesar cipher. The script should work for any printable char… read more
Brian H
Brian H
Senior Software Engineer
Master\u0027s Degree
55 satisfied customers
Write a program that prompts the user for a single
Problem 1 Write a program that prompts the user for a single line of characters terminated by a new-line character, and counts the number of vowels in the entered line. Here is a sample output of the … read more
Coder4Life
Coder4Life
CEO
High School or GED
76 satisfied customers
can anyone hep me how to use functions to manuplate matrix
can anyone help me how to use functions to manuplate matrix operation in c programming please! i have started my code to manuplate nagation, transpose, addition, and multiplication of matrices as foll… read more
jeff
jeff
Software Developer
Master\u0027s Degree
153 satisfied customers
I need help with two Python programming homeworks. They are
I need help with two Python programming homeworks. They are two very simple programs but I don't have time to do it because of exams. The links to the homeworks are posted below since the instructions… read more
Pieter
Pieter
Bachelor's Degree
28 satisfied customers
Writing a program in Python to calculate the value of e - using
Writing a program in Python to calculate the value of e - using the sum of terms.? How to calculate the value of "e" using the sum of terms. The program should ask the user how many terms he wants to … read more
Todd
Todd
Bachelor\u0027s Degree
396 satisfied customers
Hello, I have a Python script that reads a list of URLs
Hello, I have a Python script that reads a list of URLs and retrieves the H1 headline for that URL. It then writes the page's content ID code and the headline to a CSV file. I'd like to find someone t… read more
abhi_iitian
abhi_iitian
Bachelor's Degree
1,543 satisfied customers
I have to write a program in python that will allocate students
I have to write a program in python that will allocate students to tutorial sessions according to student preferences. Tutorials can only have a certain number of students. If the session is full I ha… read more
Mike B
Mike B
Computer Engineering Technologist
279 satisfied customers
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.

Show MoreShow Less

Ask Your Question

x