Welcome, Guest: Join Nairaland / LOGIN! / Trending / Recent / New
Stats: 2,716,600 members, 6,422,061 topics. Date: Thursday, 05 August 2021 at 02:41 AM

Help With This Python Programming Assignment Please - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Help With This Python Programming Assignment Please (1164 Views)

Help With This Assignment Please.. / MATLAB Programming Assignment Help - 15k / C Programming Assignment Help ? (2) (3) (4)

(1) (2) (Reply) (Go Down)

Help With This Python Programming Assignment Please by myles16(m): 4:28am On May 27, 2020
I just started with python class tho it's self taught and my first challenge is to write a program that calculate how much a $14,000 investment would be worth if it increased in value by 40% during the first year; lost $1500 in value the second year and increased 12% in the third year. Can anybody pls solve this for me?

Below is the screenshot of the one i did, i know i've been very lazy with algorithm and i would love someone to help with the normal calculation

but this is mine

print ("1. How much an investment of $14,000 would worth if it increased by 40% in it's 1st year"wink
investment= 14000 + 5600
print ("* 1st year investment would worth", investment )
print ("investment= 14000 + 5600(40%)=" , investment )
print ("2. investment lost $1,500 worth of value in it 2nd year"wink
investment= investment - 1500
print("invest lost in the second year which is $1500 "wink
print("investment worth= 18100 -", "1500 =", investment)
investment= investment + 2172
print ("value of the 3rd year increased by 12%"wink
print ("investment worth 18100 + 2172 =", investment )
print ("the Main balance of the investment is", investment)

Re: Help With This Python Programming Assignment Please by yemyke001(m): 1:06pm On May 27, 2020
myles16:
I just started with python class tho it's self taught and my first challenge is to write a program that calculate how much a $14,000 investment would be worth if it increased in value by 40% during the first year; lost $1500 in value the second year and increased 12% in the third year. Can anybody pls solve this for me?

Below is the screenshot of the one i did, i know i've been very lazy with algorithm and i would love someone to help with the normal calculation

but this is mine

print ("1. How much an investment of $14,000 would worth if it increased by 40% in it's 1st year"wink
investment= 14000 + 5600
print ("* 1st year investment would worth", investment )
print ("investment= 14000 + 5600(40%)=" , investment )
print ("2. investment lost $1,500 worth of value in it 2nd year"wink
investment= investment - 1500
print("invest lost in the second year which is $1500 "wink
print("investment worth= 18100 -", "1500 =", investment)
investment= investment + 2172
print ("value of the 3rd year increased by 12%"wink
print ("investment worth 18100 + 2172 =", investment )
print ("the Main balance of the investment is", investment)

investment = 14000
investment += 0.4*investment
print('YOUR INVESTMENT FOR THE FIRST YEAR IS:',investment)
investment -= 1500
print('YOUR INVESTMENT AFTER TWO YEARS IS:',investment)
investment += 0.12*investment
print('YOUR INVESTMENT AFTER THREE YEARS IS:', investment)
Re: Help With This Python Programming Assignment Please by yemyke001(m): 1:06pm On May 27, 2020
yemyke001:


investment = 14000
investment += 0.4*investment
print('YOUR INVESTMENT FOR THE FIRST YEAR IS:',investment)
investment -= 1500
print('YOUR INVESTMENT AFTER TWO YEARS IS:',investment)
investment += 0.12*investment
print('YOUR INVESTMENT AFTER THREE YEARS IS:', investment)


Bring on more challenge bro
Re: Help With This Python Programming Assignment Please by myles16(m): 1:44pm On May 27, 2020
yemyke001:


investment = 14000
investment += 0.4*investment
print('YOUR INVESTMENT FOR THE FIRST YEAR IS:',investment)
investment -= 1500
print('YOUR INVESTMENT AFTER TWO YEARS IS:',investment)
investment += 0.12*investment
print('YOUR INVESTMENT AFTER THREE YEARS IS:', investment)



Thanks Bro... It worked

i am not still familiar with += and -=

help with this below

1. Write a program that asks the user to enter their name. Then it should print out the
ASCII equivalent of each of the first four characters of your name. For instance,
here is a sample run of the program below.
Please enter your name: Kent
K ASCII value i s 75
e ASCII value i s 101
n ASCII value i s 110
t ASCII value i s 116

Re: Help With This Python Programming Assignment Please by yemyke001(m): 3:27pm On May 27, 2020
myles16:




Thanks Bro... It worked

i am not still familiar with += and -=

help with this below

1. Write a program that asks the user to enter their name. Then it should print out the
ASCII equivalent of each of the first four characters of your name. For instance,
here is a sample run of the program below.
Please enter your name: Kent
K ASCII value i s 75
e ASCII value i s 101
n ASCII value i s 110
t ASCII value i s 116


name = input('Please Enter your name:')
for char in name:
print(f'{char} ASCII VALUE IS {ord(char)}')
Re: Help With This Python Programming Assignment Please by yemyke001(m): 3:32pm On May 27, 2020
yemyke001:



name = input('Please Enter your name:')
for char in name:
print(f'{char} ASCII VALUE IS {ord(char)}')

Take note of the indentation, couldn't do that on NL
Re: Help With This Python Programming Assignment Please by myles16(m): 4:36pm On May 27, 2020
yemyke001:



name = input('Please Enter your name:')
for char in name:
print(f'{char} ASCII VALUE IS {ord(char)}')



i am getting syntaxError still haven't gotten where the issue is
Re: Help With This Python Programming Assignment Please by Lorienta: 4:56pm On May 27, 2020
Programming lessons for kids ages 5+ and adults in Abuja.
Python
Java
Android
Javascript
Html
Css
Php
Scratch
Very affordable and from the safety and comfort of your home.
Call: 09059206923
Re: Help With This Python Programming Assignment Please by yemyke001(m): 5:23pm On May 27, 2020
myles16:




i am getting syntaxError still haven't gotten where the issue is

What version of python are you using? Cos I ran the code and it ran... It must be 3 upward else you may need to change the string format option to % used in python 2 version
Re: Help With This Python Programming Assignment Please by myles16(m): 5:29pm On May 27, 2020
yemyke001:


What version of python are you using? Cos I ran the code and it ran... It must be 3 upward else you may need to change the string format option to % used in python 2 version




i am using the latest version which is 3.8
that's the error below
File "C:/Users/atbab/OneDrive/Desktop/programmes/correction.py", line 11, in <module>
print (f"{char}ASCII VALUE is{ord (name)}"wink
builtins.TypeError: ord() expected a character, but string of length 8 found
Re: Help With This Python Programming Assignment Please by myles16(m): 5:36pm On May 27, 2020
when i replaced that "ord" with "str" this is what it's showing me, and if i space the alphabet and the A before ASCII it's just repeating "please enter name" without showing result

please enter your name: olawale
ASCII VALUE is olawale
oASCII VALUE is olawale
lASCII VALUE is olawale
aASCII VALUE is olawale
wASCII VALUE is olawale
aASCII VALUE is olawale
lASCII VALUE is olawale
eASCII VALUE is olawale
Re: Help With This Python Programming Assignment Please by yemyke001(m): 6:08pm On May 27, 2020
myles16:





i am using the latest version which is 3.8
that's the error below
File "C:/Users/atbab/OneDrive/Desktop/programmes/correction.py", line 11, in <module>
print (f"{char}ASCII VALUE is{ord (name)}"wink
builtins.TypeError: ord() expected a character, but string of length 8 found


Try this:

name = input ('Please enter your name: ')
for letter in name:
print('The ASCII VALUE OF', letter, 'IS', ord(letter))
Re: Help With This Python Programming Assignment Please by myles16(m): 6:48pm On May 27, 2020
yemyke001:



Try this:

name = input ('Please enter your name: ')
for letter in name:
print('The ASCII VALUE OF', letter, 'IS', ord(letter))

thanks Bro... Done

please enter your name: Myles
the ASCII VALUE of is 32
the ASCII VALUE of M is 77
the ASCII VALUE of y is 121
the ASCII VALUE of l is 108
the ASCII VALUE of e is 101
the ASCII VALUE of s is 115
Re: Help With This Python Programming Assignment Please by yemyke001(m): 8:36pm On May 27, 2020
myles16:


thanks Bro... Done

please enter your name: Myles
the ASCII VALUE of is 32
the ASCII VALUE of M is 77
the ASCII VALUE of y is 121
the ASCII VALUE of l is 108
the ASCII VALUE of e is 101
the ASCII VALUE of s is 115


Ok
Re: Help With This Python Programming Assignment Please by Nobody: 10:46pm On May 27, 2020
Python lipsrsealed
Re: Help With This Python Programming Assignment Please by myles16(m): 10:50pm On May 27, 2020
locust:
Too much print functions?



That's why i came for help
Re: Help With This Python Programming Assignment Please by myles16(m): 10:50pm On May 27, 2020
locust:
Python lipsrsealed


yeah
Re: Help With This Python Programming Assignment Please by Nobody: 11:39pm On May 27, 2020
myles16:



yeah

I'm a rookie in python. Been jumping from python to JavaScript and back to css. Then on to JavaScript again. I'm just lacking focus. Don't know what I want.
Re: Help With This Python Programming Assignment Please by myles16(m): 9:03am On May 28, 2020
locust:


I'm a rookie in python. Been jumping from python to JavaScript and back to css. Then on to JavaScript again. I'm just lacking focus. Don't know what I want.



Since you're kind of strong in python, why don't you face python squarely and apply for remotes jobs if you're lucky and got accepted, good for you. Since python is wide can't you just go deep like into django and co.
Re: Help With This Python Programming Assignment Please by Nobody: 10:08am On May 28, 2020
myles16:




Since you're kind of strong in python, why don't you face python squarely and apply for remotes jobs if you're lucky and got accepted, good for you. Since python is wide can't you just go deep like into django and co.

Sorry I meant amateur.
Re: Help With This Python Programming Assignment Please by myles16(m): 11:44am On May 28, 2020
locust:


Sorry I meant amateur.


Lols
Re: Help With This Python Programming Assignment Please by pixey(m): 6:46pm On May 28, 2020
Using functions

def invest_worth():

investment = 14000
first_year = 14000*1.4
#Multiply by 140%
second_year = first_year - 1500
# Decrease by $1500
third_year = second year *1.12
# Multiply by 112%
total_worth = third_year
return "The total investment worth is
{}".format(total_worth)

invest_worth()


#This will give you the total investment value after 3 years.

Please indent the codes!
Re: Help With This Python Programming Assignment Please by myles16(m): 7:51pm On May 28, 2020
pixey:
Using functions

def invest_worth():

investment = 14000
first_year = 14000*1.4
#Multiply by 140%
second_year = first_year - 1500
# Decrease by $1500
third_year = second year *1.12
# Multiply by 112%
total_worth = first_year + second_year +
third_year
return "The total investment worth is
{}".format(total_worth)

invest_worth()


#This will give you the total investment value after 3 years.

Please indent the codes!



i think something is still missing, did you run this code?
Re: Help With This Python Programming Assignment Please by pixey(m): 7:54pm On May 28, 2020
myles16:



i think something is still missing, did you run this code?
No! But I am sure it will run well unless you did not indent the code.I think I added all instead of just returning the third year.
Re: Help With This Python Programming Assignment Please by pixey(m): 8:17pm On May 28, 2020
def invest_worth():
investment = 14000
first_year = 14000*1.4
#Multiply by 140%
second_year = first_year - 1500
# Decrease by $1500
third_year = second_year * 1.12
# Multiply by 112%
total_worth = int(third_year)
print("The total investment worth is " + str(total_worth))

invest_worth()

This will surely work now.

1 Like

Re: Help With This Python Programming Assignment Please by myles16(m): 1:04pm On May 29, 2020
pixey:
No! But I am sure it will run well unless you did not indent the code.I think I added all instead of just returning the third year.



Thanks it worked correctly tho i made little changes
Re: Help With This Python Programming Assignment Please by myles16(m): 1:29pm On May 29, 2020
pixey:
def invest_worth():
investment = 14000
first_year = 14000*1.4
#Multiply by 140%
second_year = first_year - 1500
# Decrease by $1500
third_year = second_year * 1.12
# Multiply by 112%
total_worth = int(third_year)
print("The total investment worth is " + str(total_worth))

invest_worth()






This will surely work now.


Thanks... it worked well

1 Like

Re: Help With This Python Programming Assignment Please by Albertone(m): 10:52am On May 31, 2020
myles16:



Thanks... it worked well
Hey,I'm a python beginner.Being self taught hasn't been easy for me.

Can you let me know the materials you use?
I am currently in lists,tuples after,i move to dictionaries.I hope to use python for software development
Re: Help With This Python Programming Assignment Please by myles16(m): 11:23am On May 31, 2020
Albertone:
Hey,I'm a python beginner.Being self taught hasn't been easy for me.

Can you let me know the materials you use?
I am currently in lists,tuples after,i move to dictionaries.I hope to use python for software development



i am using both videos and pdfs, there's this "python programming fundamentals" by kent d.Lee, it's a pdf of about 240+ pages, check springer books online you will see their books, and they're free. Check "Mosh Hamedani" on you-tube he has a video of about 6+ hours and another 2 hours, with a cheat sheet pdf to download below the video

and hope you've the latest python app, atleast version 3.7 or 3.8, with a good editor or IDE, you can download Wind IDE or pycharm

2 Likes

Re: Help With This Python Programming Assignment Please by Albertone(m): 2:23pm On May 31, 2020
myles16:




i am using both videos and pdfs, there's this "python programming fundamentals" by kent d.Lee, it's a pdf of about 240+ pages, check springer books online you will see their books, and they're free. Check "Mosh Hamedani" on you-tube he has a video of about 6+ hours and another 2 hours, with a cheat sheet pdf to download below the video

and hope you've the latest python app, atleast version 3.7 or 3.8, with a good editor or IDE, you can download Wind IDE or pycharm
Thanks so much.

I really appreciate
Re: Help With This Python Programming Assignment Please by myles16(m): 3:24pm On May 31, 2020
Albertone:
Thanks so much.

I really appreciate

Don't mention

1 Like

(1) (2) (Reply)

Contribute What You Know About Artificial Intelligence / INEC Voter Registration Exercise- IT Analysis / How Can Php Be Compiled And How Can I Create Crosstab?

(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 - 2021 Oluwaseun Osewa. All rights reserved. See How To Advertise. 137
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.