Hello. mylist = [6, '/', 3, '+', 9, '+', 8, '+', 1, '/', 2] How can i delete that list indexes? I tried: def clear(self, event): global numbers for i in numbers: print i del numbers[i] But it didn't work: File "./kivycal", line 83, in clear del numbers[i] TypeError: list indices must be integers, not str What can i do for that?

Member Avatar
Member Avatar
+0 forum 5

I am currently working on a program that asks a student to answer 5 simple maths questions after each question it will state whether the answer is right or not. which it will out put a grade and grade average percentage. Currently I'm stuck on the if statement where it won't recognize my integer values and insists that they are strings despite one being an actual int and the other being parsed from a string to an int. So can someone point out what I'm doing wrong here? Below is a snippet of what I have done so far Any …

Member Avatar
Member Avatar
+0 forum 2

I have a program that creates a right triangle from a loop reading "*". I have used the code to complete the first part, but the second part calls for a manipulation to take the current pattern, flip it upside down, and then add it to the first pattern. Here is the code I have so far. Can anyone guide me through how to do the reverse loop, I was thinking another loop and a nested loop within to call the opposite pattern? public static void main (String[] args) { final int LIMIT = 10; for (int row = 1; …

Member Avatar
Member Avatar
+0 forum 15

This will convert a decimal number into Gray code .

Member Avatar
Member Avatar
+1 forum 5

Hello all! I am having difficulty understanding why the range of signed integers is from -128 to +127? Assuming the size of the register is 8 bits and the leftmost bit is reserved for sign shouldn't the size be -127 to +127. I figured that for the negative values the 8th bit will have a one and if you want the maximum value, the remaining bits will too be set to 1, thus the limit for the negative values will be 11111111 = -127. I can understand why the max possible value for positive integers is +127 as the value …

Member Avatar
Member Avatar
+0 forum 3

I have to make a program that simulates a lottery. The program should have an array of 5 digits named winningdigits, a randomly generated number in the range of 0 through 9 for each element in the array. The program should ask the user to enter 5 digits and should store them in a second integer array named player. The program must compare corresponding elements in two arrrays and count how many digits match. This is an example: There are two matching digits, elements 2 and 4. winningDigits: 7, 4, 9, 1, 3 player: 4, 2, 9, 7, 3 Print …

Member Avatar
Member Avatar
+0 forum 6

How would I write this program: Wrte a program that will read a line of text that ends witha period, which serves as a sentinal value. Display all the letters that occur in the text, one per line and in alphabetical order, along with the number of times each letter occurs in the text. Use an array of base type int of length 26, so that the element at index 0 contains the number of a's, the element and index 1 contains the number of b's and so forth. Allow both uppercase and lowercase letters as input, but treat uppercase …

Member Avatar
Member Avatar
+0 forum 7

What's the difference between: int once; cout << "ok"; and this: char twice; cout << "ok"; Is the output for the first one just ok and the second one ok ok ?

Member Avatar
Member Avatar
+0 forum 10

I have a string and i want to conver the part of it to an int. I want to convert the part of the string `input[1]` to an int. But my compiler cant use atoi, or stoi.. I saw a ifstringstream option i think can work, but i tried implementing it but it didnt work.. Here is what i have. int currentqueue = 0; std::stringstream converted(input[1]); currentqueue = converted; What is wrong here?

Member Avatar
Member Avatar
+0 forum 5

So im making an RPG. For collision detection, I thought I would do it like this: 1. Read text file containing collision data. 2. Iterate through the list using nested for loops. 3. When a value of 1 occurs (denoting an inpassable tile) add a rectangle to list 'badTiles', where the x and y pos of the rectangle is the x and y value from the nested for loop times the tile width and height. 4. Now that all bad tiles are stored in a list of rectangles, we can check for collision. 5. In player class, perform a foreach …

Member Avatar
Member Avatar
+0 forum 9

So, Im making a game in c# using Xna. I have a function that will read a text file and display a map on screen, using numbers in the file as texture references. The file is a integer multidimensional array. I have another file which is used to set collision bounds, called collisionMap.txt. My thinking was this: 1. Read collision map file 2. If any value within the array equaly '1', then that tile will be inpassable. 3. Get x and y positions of that wile within the array. 4. These inpassable tiles will be added to another array containing …

Member Avatar
Member Avatar
+0 forum 2

Nice to meet you, i am a newbie i would like to ask a question that bothers me out : 1).How to add the decimal representation of N! (5 <= N <= 1,000,000) is simply the multiplicity of the prime factor 5 in N! to my script? 2). I wanted to ask how the output of case#3:118 became case#3:27,whether the problem is string or an Integer? and how to solve it? Could you help me out. thanks here's my code code: Package test; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class test { String trailing; String y; /** * @param …

Member Avatar
Member Avatar
+0 forum 3

Hi, This is my first post, forgive me for not being immediately familiar with any forum protocols. I am trying to read in a txt file and store the data in my class. I keep running into this error Exception in thread "main" java.lang.NumberFormatException: For input string: "./src.Chance" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:481) at java.lang.Integer.parseInt(Integer.java:527) at Driver.main(Driver.java:31) this is my code import java.util.*; public class Driver { private static Scanner stringScan; private static Scanner cardScan; public static void main(String[] args) { // TODO Auto-generated method stub //Instantiations Card Chance[] = new Card[16]; cardScan = new Scanner("./src.Chance"); while (cardScan.hasNext()) { stringScan = …

Member Avatar
Member Avatar
+0 forum 2

Hello, I'm currently working on a school project in which i can not get my head around into figuring out how to make a loop until the user has input an interger this is what i have so far : width = "hi" length = "hello" while width != int and length != int: width = int(input("Please enter the width of your garden in meters ")) length = int(input("Please enter the length of your garden in meters ")) obviously more needs to be added but the program still blows up every time a non integer value has been entered any …

Member Avatar
Member Avatar
+0 forum 5

I have a 8 digit number that is an int, and would like to know if there is an equivalent method that i could use on it like charAt(). or a way to take just one digit out so that it is still an int value and be able to add, multi, etc.

Member Avatar
Member Avatar
+0 forum 2

In the following piece of code i am trying to enter a 8 digit binary number then manipulate each digit seperatly. import java.util.Scanner; public class binCoverstion2{ private static Scanner kbd = new Scanner(System.in); public static void main (String[] args){ int bit0, bit1, bit2, bit3, bit4, bit5, bit6, bit7, decNumber; System.out.println("Enter a 8 digit binary number then hit enter."); String binaryNum = kbd.nextLine(); bit0 = binaryNum.charAt(0); System.out.println(bit0); The output of bit0 is just to see what the value was set too. the input i gave it was 10011001, but bit0 was set to 49. Why?

Member Avatar
Member Avatar
+0 forum 1

I am writing a program that a user inputs a 8 digit binary number and I need to convert it to a decimal number. I am trying to figure out a way for the user to enter the binary number without any deleminators, but be able to manipulate each digit of the number seperately. Any ideas

Member Avatar
Member Avatar
+0 forum 3

This is an assingment i've been working on but since this is a merge between two previous developments i need a little help solving my issue here that would be highly appreciated. In a nutshell what this program needs to do is recieve a .txt file create a vector holding all this values and apply them some sorting algorithms. Here's the code i wrote so far but as i said before what i think i need is a function to convert the vector values to an int array but i'm stuck there, so any help is appreciated. Main.cpp #include <iostream> …

Member Avatar
Member Avatar
+0 forum 3

**I really don't know what to do, and I really need the page. Please help me, thank you so much!** **The Error Code I get:** http://pastebin.com/wry2UuTA **The page code:** http://pastebin.com/xf9Ww5YS**

Member Avatar
Member Avatar
+0 forum 4

Hey everyone I was programing a small game and I am trying to figure out how to send an int value to a class and return a String from it. This is my code: This is my main.java class public class GamGUI { /** * @param args */ public static void main(String[] args) { int char1; String Playername; System.out.println("Welcome to Finaly Fantsy XXVIIV"); System.out.print("Please enter your name: "); Scanner scan = new Scanner(System.in); Playername = scan.nextLine(); System.out.println("Please select the Character you want to be"); System.out.println("Enter 1 for WARRIOR"); System.out.println("Enter 2 for BLACK MAGE"); System.out.println("Enter 3 for MONK RANGER"); char1 = …

Member Avatar
Member Avatar
+0 forum 6

I have to accept user input, a string, into a doubly linked list and print the output reversed and forward. My professor gave us the following program and told us to modify it. However, I cannot figure it out. /* Program to reverse a doubly linked list */ #include <stdio.h> #include <stdlib.h> /* a node of the doubly linked list */ struct node { int data; struct node *next; struct node *prev; }; /* Function to reverse a Doubly Linked List */ void reverse(struct node **head_ref) { struct node *temp = NULL; struct node *current = *head_ref; /* swap next …

Member Avatar
Member Avatar
+0 forum 1

Hi, thanks for looking at this thread. :) **The goal:** I have this 2D boolean array (from my [decoder](http://www.daniweb.com/software-development/java/threads/452559/decoder-simulatorcalculator-complement-of-2-problem) thread). I managed to write a method that goes through the rows and appends a '1' or a '0' to a string based on what's in the array (1 for true, 0 for false). **The problem:** I get a string containing what I need - but how do I covert a String "0101" to an int 5? I've tried parsing, casting and myString.getByte(); (and googling :) ). I assume myString.getByte(); gets me close to the goal, however I can't seem to …

Member Avatar
Member Avatar
+0 forum 2

Hi everyone. I am doing a USACO training assignment, and the instructions are as follows: > Is Friday the 13th really an unusual event? > > That is, does the 13th of the month land on a Friday less often than on any other day of the week? To answer this question, write a program that will compute the frequency that the 13th of each month lands on Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday over a given period of N years. The time period to test will be from January 1, 1900 to December 31, 1900+N-1 for a …

Member Avatar
Member Avatar
+0 forum 3

Hi I am doing a Tizag tutorial.I have created this table products with phpMyAdm in and started to populate the field.When it comes to price if I insert 13.99 the amount is rounded up to 14.I have tried everything changing to decimal, float, double but nothing seems to work,it keeps rounding up the amount.Can somebody figure out what is the problem? This is important as I'll have to insert decimal values a lot.Thank you.

Member Avatar
Member Avatar
+0 forum 3

Just a curious question, not important really. More for a discussion. Isn't using int i = 0; boolean count = false; pretty much the same thing when flagging? I mean when something goes right, change i = 1; count = true; and get the same result. What's the advantage of boolean over a simple int change? example: for (int i = 0; i < newArray.length; i++) { if (i == element) { count = true; newArray[i] = combinedInfo[i + 1]; } else if (count) newArray[i] = combinedInfo[i + 1]; else newArray[i] = combinedInfo[i]; } versus for (int i = 0; …

Member Avatar
Member Avatar
+0 forum 3

Hi! I want to make a CONVERTER. I designed it, so I just have to program some buttons. The problem that I have is weird. I programmed a button that says : CONVERT TO METER. After I build the program, I get ERROR C1075 : end of file found before the left brace '{', I don't know why. #pragma once #include "iostream" #include "cmath" using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; namespace My875346 { /// <summary> /// Summary for CMtoM /// /// WARNING: If you change the name of …

Member Avatar
Member Avatar
+0 forum 3

These days im using xcode and its a bit of annoyingly good amounts of changes from borland which im used to But i keep getting error for this printf ("\nThe amount of First Class cars Stocks remaining are: %d", &stock1); (while stock1 is declared: int stock1) and it says format types specifies type "int" but argument has type "int*" i dont understand what this means.. is a pointer being used at int? the more puzzling thing for me is that when i take out the "&" for some parts of the code: fprintf (Stocks,"\nThe amount of First Class Stocks remaining …

Member Avatar
Member Avatar
+0 forum 8

User is supposed to type an input, and if it's not an integer, the user needs to type another. This repeats 3 times for 3 inputs which go inside an array. The integer checking works, but the problem is that when i display the 3 integers, they are all the same number (the first correct input). Idk what's wrong. I've tried cin.clear() and cin.sync()... for(int i=0;i<3;i++){ cout<<"Enter your "<<text[i+6]<<": "; cin.sync(); cin.clear(); cin>>inInt[i]; if(!cin){ cout<<"\nPlease enter a valid integer."; i--; system("pause");} system("cls");}

Member Avatar
Member Avatar
+0 forum 1

I have an assignment to create 2 arrays. One holding Student names, one holding their grades. They then have to be sorted using BubbleSort, so that their grades are in descending order. I have created the first part of it, that allows me to put in their grades, and I was able to succesfully sort it using BubbleSort. I ran into a problem when I realized the professor wanted it as Doubles (I had previously had it set as Ints) and now even though I think I changed all instances of Int to Double I'm still getting an error saying …

Member Avatar
Member Avatar
+0 forum 3

Hi, I am currently making an assigment for JAVA but I am stuck. I have to make a birthdate from the three parameters: day, month and year, which are numbers = int. With this I have to put in some checks for valid dates. That part I think is done, but I get stuck at the following: I want let an if statement check the day, if the day is correct, this block of code should be run trough if (dag >=1 && dag <=31) { datum = dag; } "datum" Is a String, because I want to get the …

Member Avatar
Member Avatar
+0 forum 4

The End.