473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help with exercise!!!

1
I'm a first year computer science student.
I have been given an exercise and have no clue where to start.
Tried using count functions but have can't get the output that I need!
Any help would be greatly appreciated!!!
Thanks
Vid

input:

0 0 0 0 1 0 1 0
0 0 1 0 0 1 0 1
1 0 0 0 1 0 0 1
1 0 0 0 1 1 0 1
1 1 0 0 0 1 1 0
0 1 1 0 1 0 0 1
1 1 1 0 0 1 0 0
0 1 0 1 1 0 1 0
0 1 1 1
0 0 1 0
1 0 0 1
0 1 0 0
0 1 1 0
1 0 1 0
0 0 0 0
1 0 0 0
0 1 1
1 0 0
1 0 0
END

output:

0: 4 6
1: 2 5 7
2: 0 4 7
3: 0 4 5 7
4: 0 1 5 6
5: 1 2 4 7
6: 0 1 2 5
7: 1 3 4 6
0: 1 2 3
1: 2
2: 0 3
3: 1
0: 1 2
1: 0 2
2:
3: 0
0: 1 2
1: 0
2: 0


Basically, the program is supposed to give the position of the 1's for each line.
I have tried using a mix of count, def and pop functions but nothing is going my way.
Any help would be greatly appreciated!
Apr 29 '10 #1
1 1017
YarrOfDoom
1,247 Expert 1GB
Maybe a look trough here will give you some ideas.
Apr 29 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Trvl Orm | last post by:
I am working with 2 frames, Left and Right and the main code is in the left frame, which has been attached. Can someone please help me with this code. I am new to JavaScript and can't figure it...
14
by: TrvlOrm | last post by:
OK. After much playing around, I managed to get my frame page this far.. see code below. BUT...there are still errors with it, and what I would like to have happened is this: 1) On the Left...
5
by: Richard Gromstein | last post by:
Hello, I have an exercise that I need to finish very soon and I really need help understanding what to do and how exactly to do it. I am working on reading the chapter right now and working on it...
5
by: arnuld | last post by:
this is a programme that counts the "lengths" of each word and then prints that many of stars(*) on the output . it is a modified form of K&R2 exercise 1-13. the programme runs without any...
24
by: Michael Tobis | last post by:
I want a list of all ordered permutations of a given length of a set of tokens. Each token is a single character, and for convenience, they are passed as a string in ascending ASCII order. For...
14
by: Jeff | last post by:
Hello I'm teaching myself web programming in ASP.NET using freely available online resource and videos. It's going really well and I've built myself some personal web pages based on the Visual...
2
by: cioccolatina | last post by:
Hey guys, is there anyone who could help me..? I have file ExpressionBinaryTree.java : /** class ExpressionBinaryTree * uses a binary tree to represent binary expressions * does not...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.