REVscene - Vancouver Automotive Forum


Welcome to the REVscene Automotive Forum forums.

Registration is Free!You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! The banners on the left side and below do not show for registered users!

If you have any problems with the registration process or your account login, please contact contact us.


Go Back   REVscene Automotive Forum > Vancouver LifeStyles (VLS) > Campus Forum

Campus Forum THIS SPACE OPEN FOR ADVERTISEMENT. YOU SHOULD BE ADVERTISING HERE!
The Student Life
School events, activities, rate your prof, students helping each other..

Reply
 
Thread Tools
Old 02-28-2013, 07:33 AM   #12076
CRS
ninja edits your posts without your knowledge
 
CRS's Avatar
 
Join Date: Jan 2004
Location: Vancouver
Posts: 14,997
Thanked 6,370 Times in 1,795 Posts
Failed 114 Times in 70 Posts
So CMPT guys.... Python Gods.....

I'm trying to count the number of LETTERS/CHARACTERS in a string and not its numbers/special characters.

So in a string like "abc132add" it would count 6 (only the letters) any idea how to do this?

I'm not looking for a position thing because the strings can be different.
Advertisement
__________________
Revscene Classifieds Moderator

My FeedBack 53-0-0
CRS is offline   Reply With Quote
Old 02-28-2013, 07:42 AM   #12077
What hasn't Killed me, has made me more tolerant of RS!
 
Join Date: Jul 2012
Location: van island
Posts: 172
Thanked 72 Times in 27 Posts
Failed 37 Times in 10 Posts
Look for asci characters and see which of them are the letters. Then if the asci is between that range, count it as a letter
Messerschmitt is offline   Reply With Quote
Old 02-28-2013, 07:45 AM   #12078
CRS
ninja edits your posts without your knowledge
 
CRS's Avatar
 
Join Date: Jan 2004
Location: Vancouver
Posts: 14,997
Thanked 6,370 Times in 1,795 Posts
Failed 114 Times in 70 Posts
Quote:
Originally Posted by Messerschmitt View Post
Look for asci characters and see which of them are the letters. Then if the asci is between that range, count it as a letter
I think that's too advanced? I was going to do some variation of len(st) or st.count(abcd...).

But neither of those work....

__________________
Revscene Classifieds Moderator

My FeedBack 53-0-0
CRS is offline   Reply With Quote
Old 02-28-2013, 08:03 AM   #12079
Hopeless Romantic
 
jtanner_'s Avatar
 
Join Date: Sep 2006
Location: Surrey
Posts: 2,544
Thanked 989 Times in 232 Posts
Failed 12 Times in 7 Posts
Quote:
Originally Posted by CRS View Post
I think that's too advanced? I was going to do some variation of len(st) or st.count(abcd...).

But neither of those work....

Oh god it's been a long time since I took cmpt120... but can't you use isdigit and isalpha?

ex.

"a".isalpha() should return true, and "a".isdigit() should return false...

So after you define your input...

count=0
for char in input:
if isalpha(char):
count +=1
return count



Otherwise I think Messer is right in that you can use string.ascii too.. but I don't have python on this computer to play around with lol.
__________________
Feedback Thread (14-0-0)

2002 Acura RSX (Sold)
1993 Mitsubishi Lancer Evo I (Sold)
2005 Mitsubishi Lancer Evo VIII (Daily Driven)
jtanner_ is offline   Reply With Quote
Old 02-28-2013, 08:24 AM   #12080
member
 
Join Date: Aug 2011
Location: Vancouver
Posts: 119
Thanked 88 Times in 31 Posts
Failed 1 Time in 1 Post
Quote:
Originally Posted by bmwx1 View Post
Lmao that face when you get up at 4am is what I'm experiencing right now. Are you the guy near the engineering building exit with the openroad promotion and that Scion FRS outside?
Yep! We're up there today as well with that autographed Burrows jersey prize.
OpenRoadAutoGrp is offline   Reply With Quote
This post thanked by:
Old 02-28-2013, 08:54 AM   #12081
CRS
ninja edits your posts without your knowledge
 
CRS's Avatar
 
Join Date: Jan 2004
Location: Vancouver
Posts: 14,997
Thanked 6,370 Times in 1,795 Posts
Failed 114 Times in 70 Posts
Quote:
Originally Posted by jtanner_ View Post
Oh god it's been a long time since I took cmpt120... but can't you use isdigit and isalpha?

ex.

"a".isalpha() should return true, and "a".isdigit() should return false...

So after you define your input...

count=0
for char in input:
if isalpha(char):
count +=1
return count



Otherwise I think Messer is right in that you can use string.ascii too.. but I don't have python on this computer to play around with lol.
No workie...



Thanks though!

Anyone know any good cmpt tutors?
__________________
Revscene Classifieds Moderator

My FeedBack 53-0-0
CRS is offline   Reply With Quote
Old 02-28-2013, 09:06 AM   #12082
Hopeless Romantic
 
jtanner_'s Avatar
 
Join Date: Sep 2006
Location: Surrey
Posts: 2,544
Thanked 989 Times in 232 Posts
Failed 12 Times in 7 Posts
Quote:
Originally Posted by CRS View Post
No workie...



Thanks though!

Anyone know any good cmpt tutors?
Really? What does it return? So fail...

Quote:
def main():
<I>sentence = input('Enter a sentence: ')
<I> Stats(sentence)

def Stats(input):
<I>print('Letters:', letter(input))

def letter(input):
<I>count=0
<I>for char in input:
<I><I> if isalpha(char):
<I><I><I> count += 1
<I> return count
Sorry... I tried installing python but I don't have administrator rights so it won't let me lol. Indents don't seem to show lol. where <I> represents an indent
__________________
Feedback Thread (14-0-0)

2002 Acura RSX (Sold)
1993 Mitsubishi Lancer Evo I (Sold)
2005 Mitsubishi Lancer Evo VIII (Daily Driven)
jtanner_ is offline   Reply With Quote
Old 02-28-2013, 09:44 AM   #12083
ph0
Proud to be called a RS Regular!
 
Join Date: Jan 2013
Location: Burnaby
Posts: 107
Thanked 21 Times in 16 Posts
Failed 0 Times in 0 Posts
Quote:
Originally Posted by CRS View Post
So CMPT guys.... Python Gods.....

I'm trying to count the number of LETTERS/CHARACTERS in a string and not its numbers/special characters.

So in a string like "abc132add" it would count 6 (only the letters) any idea how to do this?

I'm not looking for a position thing because the strings can be different.
So here's a pseudocode I came up with for this:

alphabet = letters of alphabet (lowercase and uppercase)
intizalize count to 0
for letters in string //Check each character in string
if letters in alphabet //if character is in the alphabet than count + 1
count = count + 1
return count
Spoiler!
ph0 is offline   Reply With Quote
Old 02-28-2013, 10:12 AM   #12084
CRS
ninja edits your posts without your knowledge
 
CRS's Avatar
 
Join Date: Jan 2004
Location: Vancouver
Posts: 14,997
Thanked 6,370 Times in 1,795 Posts
Failed 114 Times in 70 Posts
Thanks for the effort all.

Assignment closed already. I'll post up answers once they are received.
__________________
Revscene Classifieds Moderator

My FeedBack 53-0-0
CRS is offline   Reply With Quote
Old 02-28-2013, 01:32 PM   #12085
RS.net, where our google ads make absolutely no sense!
 
Join Date: Mar 2011
Location: Richmond
Posts: 916
Thanked 693 Times in 227 Posts
Failed 68 Times in 25 Posts
Quote:
Originally Posted by jtanner_ View Post
Really? What does it return? So fail...



Sorry... I tried installing python but I don't have administrator rights so it won't let me lol. Indents don't seem to show lol. where <I> represents an indent
problem with isalpha(char) is that it is supposed to be string.isalpha();, so you would need to do

for i in range 1 to len(string)
if string[i-1].isalpha()
count += 1;
Geoc is offline   Reply With Quote
Old 02-28-2013, 05:43 PM   #12086
Where's my RS Christmas Lobster?!
 
vyrospec's Avatar
 
Join Date: Apr 2011
Location: Arkhangelsk
Posts: 861
Thanked 360 Times in 142 Posts
Failed 17 Times in 13 Posts
wow so much comp sci support.

anyways: summer enrollment dates released
I got a March 15th 2:30
__________________
Inactive
'01 Corolla 'Goldfish' - (RIP)
'96 Accord EX 'Aoi' - (Sold)
'98 EJ8 Civic Si 'DatSi' - (Sold)
'11 MKVI Golf 'Dana' - (Sold)

Active:

'18 F22 230iX' (DD)

Quote:
Originally Posted by Badhobz View Post
Don’t you guys dare bid on my gay car. I’ll stab you
vyrospec is offline   Reply With Quote
Old 02-28-2013, 05:45 PM   #12087
RS.net, where our google ads make absolutely no sense!
 
Join Date: Mar 2011
Location: Richmond
Posts: 916
Thanked 693 Times in 227 Posts
Failed 68 Times in 25 Posts
Quote:
Originally Posted by vyrospec View Post
wow so much comp sci support.

anyways: summer enrollment dates released
I got a March 15th 2:30
Used to be in bus, then realize it's a pointless degree unless you're in accounting. So I switched to a BSc. degree
Geoc is offline   Reply With Quote
Old 02-28-2013, 05:52 PM   #12088
Rs has made me the woman i am today!
 
yray's Avatar
 
Join Date: Jan 2012
Location: PENIS
Posts: 4,408
Thanked 4,264 Times in 1,353 Posts
Failed 298 Times in 126 Posts
Quote:
Originally Posted by vyrospec View Post
wow so much comp sci support.

anyways: summer enrollment dates released
I got a March 15th 2:30
10:30
__________________
There's a phallic symbol infront of my car

Quote:
MG1: in fact, a new term needs to make its way into the American dictionary. Trump............ he's such a "Trump" = ultimate insult. Like, "yray, you're such a trump."
bcrdukes yray fucked bcrdukes up the nose

dapperfied yraisis
dapperfied yray so waisis

FastAnna you literally talk out your ass
FastAnna i really cant
FastAnna yray i cant stand you
yray is online now   Reply With Quote
Old 02-28-2013, 05:54 PM   #12089
Where's my RS Christmas Lobster?!
 
vyrospec's Avatar
 
Join Date: Apr 2011
Location: Arkhangelsk
Posts: 861
Thanked 360 Times in 142 Posts
Failed 17 Times in 13 Posts
Quote:
Originally Posted by Geoc View Post
Used to be in bus, then realize it's a pointless degree unless you're in accounting. So I switched to a BSc. degree
you should join me in ECON
__________________
Inactive
'01 Corolla 'Goldfish' - (RIP)
'96 Accord EX 'Aoi' - (Sold)
'98 EJ8 Civic Si 'DatSi' - (Sold)
'11 MKVI Golf 'Dana' - (Sold)

Active:

'18 F22 230iX' (DD)

Quote:
Originally Posted by Badhobz View Post
Don’t you guys dare bid on my gay car. I’ll stab you
vyrospec is offline   Reply With Quote
Old 02-28-2013, 06:30 PM   #12090
Where's my RS Christmas Lobster?!
 
Join Date: Nov 2012
Location: Vancouver
Posts: 848
Thanked 1,198 Times in 245 Posts
Failed 326 Times in 95 Posts
Damn why are you guys so early? Mine is on the 21st. Is it because you guys are in 4th year, a lot of units accumulated, or high GPA?
is350 is offline   Reply With Quote
Old 02-28-2013, 06:31 PM   #12091
ph0
Proud to be called a RS Regular!
 
Join Date: Jan 2013
Location: Burnaby
Posts: 107
Thanked 21 Times in 16 Posts
Failed 0 Times in 0 Posts
Mine's on the 25th LOL daymmmmm but going to vietnam this summer, so no summer semesterr
ph0 is offline   Reply With Quote
Old 02-28-2013, 06:49 PM   #12092
The Brown Reason
 
BrRsn's Avatar
 
Join Date: Jan 2007
Location: Whalley
Posts: 4,607
Thanked 5,863 Times in 1,525 Posts
Failed 221 Times in 97 Posts
Fuck

Ever take a class that is hard, miss a midterm, add weight to your final, and realize it's fucking hard?

I did. Final is worth 80%, midterm 20%
Will reply back with results
__________________
Quote:
Originally Posted by bcrdukes
fuck this shit, i'm out
BrRsn is offline   Reply With Quote
Old 02-28-2013, 07:00 PM   #12093
RS.net, where our google ads make absolutely no sense!
 
Join Date: Mar 2011
Location: Richmond
Posts: 916
Thanked 693 Times in 227 Posts
Failed 68 Times in 25 Posts
Quote:
Originally Posted by vyrospec View Post
you should join me in ECON
I'm actually majoring in econ as well...
Geoc is offline   Reply With Quote
Old 02-28-2013, 07:06 PM   #12094
Rs has made me the woman i am today!
 
yray's Avatar
 
Join Date: Jan 2012
Location: PENIS
Posts: 4,408
Thanked 4,264 Times in 1,353 Posts
Failed 298 Times in 126 Posts
Quote:
Originally Posted by bmwx1 View Post
Damn why are you guys so early? Mine is on the 21st. Is it because you guys are in 4th year, a lot of units accumulated, or high GPA?
it's cuz i failed too many courses
__________________
There's a phallic symbol infront of my car

Quote:
MG1: in fact, a new term needs to make its way into the American dictionary. Trump............ he's such a "Trump" = ultimate insult. Like, "yray, you're such a trump."
bcrdukes yray fucked bcrdukes up the nose

dapperfied yraisis
dapperfied yray so waisis

FastAnna you literally talk out your ass
FastAnna i really cant
FastAnna yray i cant stand you
yray is online now   Reply With Quote
Old 02-28-2013, 07:34 PM   #12095
nma
#RVG
 
nma's Avatar
 
Join Date: Sep 2008
Location: BBY
Posts: 573
Thanked 633 Times in 205 Posts
Failed 102 Times in 17 Posts
anyone in econ 345 and/or 354? both midterms tomorrow..

nma is offline   Reply With Quote
Old 02-28-2013, 07:45 PM   #12096
Where's my RS Christmas Lobster?!
 
vyrospec's Avatar
 
Join Date: Apr 2011
Location: Arkhangelsk
Posts: 861
Thanked 360 Times in 142 Posts
Failed 17 Times in 13 Posts
^ im in 345, how u preparing for it
__________________
Inactive
'01 Corolla 'Goldfish' - (RIP)
'96 Accord EX 'Aoi' - (Sold)
'98 EJ8 Civic Si 'DatSi' - (Sold)
'11 MKVI Golf 'Dana' - (Sold)

Active:

'18 F22 230iX' (DD)

Quote:
Originally Posted by Badhobz View Post
Don’t you guys dare bid on my gay car. I’ll stab you
vyrospec is offline   Reply With Quote
Old 02-28-2013, 07:47 PM   #12097
nma
#RVG
 
nma's Avatar
 
Join Date: Sep 2008
Location: BBY
Posts: 573
Thanked 633 Times in 205 Posts
Failed 102 Times in 17 Posts
just trying to do practice exams to see how well i know the material, it gets kinda confusing to be honest I haven't been paying much attention in lecture lol
nma is offline   Reply With Quote
Old 02-28-2013, 07:51 PM   #12098
nma
#RVG
 
nma's Avatar
 
Join Date: Sep 2008
Location: BBY
Posts: 573
Thanked 633 Times in 205 Posts
Failed 102 Times in 17 Posts
Quote:
Originally Posted by yray View Post
10:30
9:30
nma is offline   Reply With Quote
Old 02-28-2013, 08:12 PM   #12099
Where's my RS Christmas Lobster?!
 
vyrospec's Avatar
 
Join Date: Apr 2011
Location: Arkhangelsk
Posts: 861
Thanked 360 Times in 142 Posts
Failed 17 Times in 13 Posts
Quote:
Originally Posted by nma View Post
just trying to do practice exams to see how well i know the material, it gets kinda confusing to be honest I haven't been paying much attention in lecture lol
ya pretty much the same. did 3 mts over the weekend. now to finish 2 more practice that i missed out when downloading the stuff. im surprised at how well i did so far.
__________________
Inactive
'01 Corolla 'Goldfish' - (RIP)
'96 Accord EX 'Aoi' - (Sold)
'98 EJ8 Civic Si 'DatSi' - (Sold)
'11 MKVI Golf 'Dana' - (Sold)

Active:

'18 F22 230iX' (DD)

Quote:
Originally Posted by Badhobz View Post
Don’t you guys dare bid on my gay car. I’ll stab you
vyrospec is offline   Reply With Quote
Old 02-28-2013, 08:13 PM   #12100
nma
#RVG
 
nma's Avatar
 
Join Date: Sep 2008
Location: BBY
Posts: 573
Thanked 633 Times in 205 Posts
Failed 102 Times in 17 Posts
it's not that bad I'm just screwed because I have two exams back to back tomorrow, all the information is kind of overwhelming lol
nma is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -8. The time now is 09:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
SEO by vBSEO ©2011, Crawlability, Inc.
Revscene.net cannot be held accountable for the actions of its members nor does the opinions of the members represent that of Revscene.net