Python Forum
Please explain how to alter text with python code?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please explain how to alter text with python code?
#1
# Complete the following remove_dollar function
# so that it removes any dollar signs and spaces
# and then returns the string as a number (float).
def remove_dollar(s):



csv file data is :
LastSpend Spend
$144.5 $596
4502.2 $761.6
Reply
#2
What have you tried? We're not big on writing code for people here, but we would be happy to help you fix your code when you run into problems. When you do run into problems, please post your code in Python tags, and clearly explain the problem you are having, including the full text of any errors.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
# Complete the following remove_dollar function 
# so that it removes any dollar signs and spaces
# and then returns the string as a number (float).
def remove_dollar(s):
csv file data is :
Output:
LastSpend Spend $144.5 $596 4502.2 $761.6
how can we write a program that removes $ from the column values i.e. LastSpend and Spend
Reply
#4
By showing some effort. You have done nothing but post your homework assignment. We're not doing your homework for you. Again, make an actual attempt to write the code, tell us how it doesn't work, and we'll help you.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
https://docs.python.org/3/library/stdtyp...e-type-str
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Explain a piece of code SuuzyQ04 1 1,569 Nov-19-2020, 07:13 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020