what a teacher your are Snippsat. impressed!
richieking 44 Master Poster
richieking 44 Master Poster
richieking 44 Master Poster
richieking 44 Master Poster
what a teacher your are Snippsat. impressed!
wx the best of all.
lets start the Gui wars !
try simplify the logic and what you want to achieve. This could be done in well optimised way.
Post your new indented cde please
You must work on your indentation first. All of them are off.
Check out he try's and except. Else's and if's.
They are al not properly indented. Fix that first ok?
if its in console, Then you just get the user input and check the value.
Then instruct your system based on that choice.
As Gris said. I will do th same. Sometimes the problem as very coders faces is not the code but logic and with a litle thinking can help solve our problems.
You designed a very nice menu but complicated a simple exit. I just wonder how you couldnt see this little thing. Anyway thats my view.
happy coding :)
or
print(int(i)+1))
Do you have any error msgs?
please post them
You get permission denied because the machine you want to login does not have the user as root. I guess you are trying to login into linux box right?
Use the user name and password you use to login to the box. root will not give you the permission.
to put code int the code tags. Do this
1. Push the (CODE) tags sign right on the border infront of you.
2. Put your code inside the tags.
3. Then Click on post
sorry i don't know what you've done there, there's still a tuple for range which it doesn't like, i got closer on my more recent post
Look i dont think you really need a help.
If you vote people down. If you can do your stuff, you dont ask it here period. also i gave you an idea about how checks should be done so that you can understand how its done. No one is here to do your job for you. We are here to help and you must be very thankful for that.
put your code in the tags ok.??
once you do, i will help
CSV is better with a dict,
I wrote some script here in daniweb. search for it.
The dict with incremental keys that will help with your rows and columns.
Or
tosearch ='my text' try: print(next(line for line in open('myfile.txt') if tosearch.lower() in line.lower())) except StopIteration: print('Text %r not found in file' % tosearch)
If you prefer clean code ;)
tony did you try your code.???
Next come with a yield iter and calling next without any import or a method/class defined for next.... Do you recomemed that??
I think is not a good stuff. Also i wonder if this algo with produce a result.
from my htc phone.
:)
Always do a logical known check first
trainingDays = trainingData.getMeasurements()
for i in range(pDaysRange,32):
for day in trainingDays:
if day[i].condition == "Fog":
prevDaysF += 0.5
if day[i].condition == "Snow":
prevDaysS += 0.5
if day[i].condition == "Rain":
prevDaysR += 0.5
if day[i].condition == "None":
prevDaysN += 0.5
print prevDaysF
1.Make a list of your vowels.
2.Read the text file
3. Read character per character
4.Check if the char is in the vowels.
Job done :)
well if you are happy.... Then mark the thresd as solved.
:)
Hope you got it now... ;)
Well i just gave you an idea. carry on from there.
:)
ahappysadface can you help yourself so that we can help you ok?
Riechieking, you should test your code before posting. This can't work in python because
word = wordlist[2]
is not an expression but a statement. This is a C idiom, not a python one.
Grib your are right. Its a C++ style. I just send that from my htc phone and there was no time to test.
I will check it up one I get home.
Cheers
for((word = wordlist[-2]) in ['ar','er',ir']):
print word
well mark thread as solved ;)
try const with the types
int game(const string &soFar, const string &THE_WORD, const int &MAX_WRONG,const int &wrong,const string &used);
You have mixed them up. const variable into a non const method values.
parijat24 You just need to look into sets very well.
set can work on tuples and list but cant mix them . The data must be one thus a list or a tuple. Set checks the data type also.
item.GetParent() will do ok?
can you tell me why you inported sys module???
also break help here...
while True:
words = text.lower().split()
for word in words:
word_count = len(word)
word_list.append(word_count)
break;
print word_count,word_list
Another flavour....;)
def main():
print len([x for x in raw_input("enter a phrase:" ).split()])
main()
well then he can try and except the error gracefuly cant he?
But that is not the logic.
You need to reset the list container or delete.
But you dont have to initialize a list in a loop.
no good ;)
you do you intend to do?? any plans?
And also try and look into switch statement ok?
Its more robust and easy to use. Besides its more easy to extend and debug.
;)
should be the first one.
but it does not really matters. It all depends on your data.
just append your data;
testingdays = testingData.getMeasurements()
dayValues = []
for day in testingdays:
dayValues.append(day.tempMean)
dayValues.append(day.tempMax)
dayValues.append(day.tempMin)
dayValues.append(day.dewPoint)
dayValues.append(day.humidMean)
dayValues.append(day.humidMax)
dayValues.append(day.humidMin)
dayValues.append(day.pressure)
dayValues.append(day.meanWindSpeed)
dayValues.append(day.maxWindSpeed)
dayValues.append(day.maxGustSpeed)
dayValues.append(day.visibility)
And you are ready to go. And dont put or initialize list in a loop ok?
;)
is your win7 32 bit??
i was wondering what was the point of checking main in counteven at all??
updated.
on lines 16 and 30... do this
cout<<"**";
to both numbers.
It will produe a better draw.
==out put==
10
Enter the height
10
**********************
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
**********************
brute force here....
#include <iostream>
using namespace std;
void rec(int &right,int&left){
if(right != left){
cout <<" left and right must be the same int value";
return;
}
for(int a=0;a<right+1;a++)
{
cout <<"* ";
}
cout<<endl;
for(int x =0;x<right;x++){
cout <<"*";
for(int i=0;i<left;i++){
cout <<" ";
}
cout <<"*\n";
}
for(int a=0;a<right+1;a++)
{
cout <<"* ";
}
}
int main(){
int left,right;
cout <<"Your width and height int values must be the same. \n";
cout <<"Example width=30, height=30\n";
cout <<"Enter the width\n";
cin>> left;
cout <<"Enter the height\n";
cin>>right;
rec(left,right);
return 0;
}
######## output ####
Your width and height int values must be the same.
Example width=30, height=30
Enter the width
10
Enter the height
10
* * * * * * * * * * *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* * * * * * * * * * *
stan2000 plz put your code in the code tags
@ richieking He already has the algorithm to make a solid rectangle he is trying to make an empty one. Also what you have puts an extra Astrix on each line so your rectangle would be 10x21.
try and run it and see it first ok?
try this
void rec(int &right,int&left){
for(int x =0;x<right;x++){
for(int i=0;i<left;i++){
cout <<"*";
}
cout <<"*\n";
}
}
int main(){
int l=10,r=20;
rec(l,r);
return 0;
}
making things clear
#include <iostream>
#include <string>
using namespace std;
void showresult(string name){
string take;
if("rose" == name){
cout <<"name found...... Access granted\n";}
else{
cout <<"Alarm alarm !!\a\n";
}}
int main(int argc, char *argv[]){
string nameTake;
while (true){
cout << "enter your name plz or enter to quit\n";
getline(cin,nameTake);
if(nameTake.empty()||nameTake=="quit"){
cout <<"Programe terminated by user\n";
break;
}
showresult(nameTake);
}
return 0;
}
on line 7,
your
def _init_(self)
must be this ->
def __init__(self)
a double underscore!
:)
but you code does not have any ref. to wxlistctrl????
You must create a listctrl and bind that to your popup menu method. Very simple ;-)
when you double click a listctrl the nearest logic menu should be popup menu. Is that what you want?
or you want to build a dynamic propagated menu based on user clicks????
i dont really get you man. Sorry
Try this c style
data_list = [
(1, 'Dave'),
(234, 'Einstein'),
(100000, 'Bob')
]
print("Printing out to file 'test123.txt' ...")
with open("test123.txt", "w")as fout:
fout.write("".join(["%10d %30s \n"%(x[0],x[1]) for x in data_list]))
print("".join(["%10d %30s \n"%(x[0],x[1]) for x in data_list]))
###output
Printing out to file 'test123.txt' ...
1 Dave
234 Einstein
100000 Bob
can you make yourself more clearer?
Post some code if possible ok?