+ 2

Where did mess up....

I'm not getting what it wants me to do.. # Asks the user to enter the savings savings = input("Enter your savings:") # Convert the user input into a float value and update the variable savings = float(input("Enter your savings:")) # Savings grow after 1 year at a 5% annual interest rate balance = savings * 1.05 # Convert the balance into a string and update the variable balance = str(balance) # Concatenate the 2 strings to produce a message message = "Amount in 1 year: " + balance # Display the message print(message) Pls help..

2nd Aug 2025, 7:35 PM
Lucky Zxy
Lucky Zxy - avatar
13 Antwoorden
+ 4
In the second line of code, you need to write savings=float(savings) instead of savings=float(input()).
2nd Aug 2025, 7:43 PM
Mila
Mila - avatar
+ 6
Did the task come with the text "enter your savings", or did you add that? Look closely at your 2nd line of coding (ignoring comments). Do you need input 2x? *hint: maybe that's the line to change
2nd Aug 2025, 7:40 PM
Ausgrindtube
Ausgrindtube - avatar
+ 3
Thanks.. I was writing it 2 times.. This is the correct code according to the question # Asks the user to enter the savings savings = input() # Convert the user input into a float value and update the variable savings = float(savings) # Savings grow after 1 year at a 5% annual interest rate balance = savings * 1.05 # Convert the balance into a string and update the variable balance = str(balance) # Concatenate the 2 strings to produce a message message = "Amount in 1 year: " + balance # Display the message print(message)
2nd Aug 2025, 8:03 PM
Lucky Zxy
Lucky Zxy - avatar
+ 3
Lucky Zxy What also could be an helpful feature, which is in my personal opinion much too less used in Python, is to work with the `->`-operator to strictly type Pythonic values. For example like: ```python def get_float(prompt: str) -> float: """ Prompt the user until they enter a valid float. """ while True: entry = input(prompt) try: value = float(entry) return value except ValueError: print(f"❗️ '{entry}' is not a valid number. Please try again.") ```
5th Aug 2025, 2:01 AM
Konan
Konan - avatar
+ 2
Aditya Aditya 💁 (sorry for eventual incorrect translation): ```python # उपयोगकर्ता से दो संख्याएँ इनपुट लें num1 = float(input("पहली संख्या दर्ज करें: ")) num2 = float(input("दूसरी संख्या दर्ज करें: ")) # गुणनफल निकालें product = num1 * num2 # परिणाम दिखाएं print("गुणनफल है:", product) ```
5th Aug 2025, 2:08 AM
Konan
Konan - avatar
+ 1
Aditya Aditya , we are here to help each other learn together. Please specify your problem or question so that we can solve it together.
4th Aug 2025, 3:46 PM
Ushasi Bhattacharya
+ 1
Lucky Zxy All above reply is much better but i just want to show python magic use this code. print ("Amount in 1 year :",float(input())*1.05) See you desire out that you want to print. only by single line of code
8th Aug 2025, 5:54 PM
ANURAG SHAHIB
ANURAG SHAHIB - avatar
+ 1
ANURAG SHAHIB , thank you for sharing your knowledge! I would like to tell you that even though one liners are short yet precise and effective, they are difficult to understand at first glance especially if you are a beginner. However, this was a comparitively simple and easy one. Lucky Zxy , kindly let us know if that helped. And if you have further questions, feel free to ask!
8th Aug 2025, 10:36 PM
Ushasi Bhattacharya
0
# Ask the user to enter savings (only once) and convert to float savings = float(input("Enter your savings: ")) # Calculate balance after 1 year with 5% interest balance = savings * 1.05 # Round to 2 decimal places (if needed for currency) balance = round(balance, 2) # Convert to string for concatenation balance_str = str(balance) # Construct and print the message message = "Amount in 1 year: " + balance_str print(message)
3rd Aug 2025, 7:14 AM
AYESHA NOOR
AYESHA NOOR - avatar
0
Hi I am new please help me
3rd Aug 2025, 12:46 PM
Aditya Aditya
Aditya Aditya - avatar
0
Hello python me kaise 2 no. Ka product kaise kar
4th Aug 2025, 1:05 PM
Raj Verma
Raj Verma - avatar
0
Reply please dena
4th Aug 2025, 1:06 PM
Raj Verma
Raj Verma - avatar
0
Raj Verma , if you want to output the product of two input numbers, you may use the multiplication (*) operator. n1 = float(input()) n2 = float(input()) print(n1*n2) Test case: n1 = 3 n2 = 13 Output: 39
4th Aug 2025, 3:43 PM
Ushasi Bhattacharya