Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Debugging Help part2

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the expected out put from my test case (1 100) is supposed to be 5050 0 5050 but instead i get 0 0 0. I assume it has to do something with the queuesize
RandomQueue.png
My output
My output
randomQueue2.png
expected output
expected output
 
Marshal
Posts: 25961
70
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your input assumed that the program would take the first two parameters from the command line and use them for something. But there's no code in the program which uses parameters from the command line. Instead there is code which assumes that a sequence of numbers will be typed into stdin, as in your "expected output" picture. Since you typed no numbers at all into stdin, the output was based on summing that (empty) set, which returns zero.
 
John Luxbrand
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:Your input assumed that the program would take the first two parameters from the command line and use them for something. But there's no code in the program which uses parameters from the command line. Instead there is code which assumes that a sequence of numbers will be typed into stdin, as in your "expected output" picture. Since you typed no numbers at all into stdin, the output was based on summing that (empty) set, which returns zero.


Oh you're right lol im dumb but thank you! Is there a quick way to type these 1-100 in sequence in the terminal? or do i just manually add them 1 at a time?
 
Paul Clapham
Marshal
Posts: 25961
70
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The picture you posted for "expected output" looks to me like it's what you just asked for.
 
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic