Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,615 members, 7,809,254 topics. Date: Friday, 26 April 2024 at 06:50 AM

Help This Newbie - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help This Newbie (1068 Views)

Help A Newbie To Coding. / JS Or PHP Frameworks? Which One Is Better For A Newbie / Are You A Newbie Java Programmer (2) (3) (4)

(1) (Reply) (Go Down)

Help This Newbie by Argonn(m): 2:12pm On Apr 03, 2017
Hello World!

I'm a newbie programmer and I want someone to please help me with the differences btw the following:

1.) a = a + 1

2.) a =+ 1

3.) a += 1


God bless you guys.
Re: Help This Newbie by Dreadlord: 3:11pm On Apr 03, 2017
For languages that supports it. A += 1 is a shorthand for A = A + 1. It used to be an optimisation technique, but right now it is part of a style of programming, it offers no significant gain in speed of the programme.
A =+ 1 is a syntax error.

1 Like

Re: Help This Newbie by Argonn(m): 4:15pm On Apr 03, 2017
Thanks
Re: Help This Newbie by Argonn(m): 4:16pm On Apr 03, 2017
Please what is the difference btw a++ and ++a
Re: Help This Newbie by rayyspark(m): 1:19pm On Apr 05, 2017
eg if a=3 a++ means 3+1 ... ++a means 1+3 ... hope this help u out a little.
Re: Help This Newbie by Argonn(m): 10:41am On Apr 07, 2017
Please I need a pro to check this code for m. Its a program should accept input for user and count the number of vowels and consonants.

The Code:

v_count = 0
c_count = 0
alphabets = []
vowels = ['a', 'e', 'i', 'o', 'u']
consonants []

for i in vowels:
....vowels.append(chr(ord(i)-32))
....#update the vowels list with caps
for i in range(65, 91):
....alphabet.append(chr(i))
....alphabet.append(chr(i+32))
....#update the alphabets list
for i in alphabets:
....if i not in vowels:
........consonants.append(i)
........#update the consonants list

text = input("Enter text:\t"

for letter in text:
....if letter in vowels:
........v_count += 1
....elif letter in consonants:
........c_count += 1
....else:
........continue

print("vowels: " + str(v_count))
print("consonants: " + str(c_count))

(1) (Reply)

Urgent Programmer Needed / Come For Your Web Design And Web Development At A Discount Rate / Meet A Wordpress Consultant

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 9
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.