Python Beginner, Need help with a course I'm doing

Imagine you are running a fundraiser, users will enter their name and donation in dollars into your program. If the name is invalid (empty string), print Invalid name. If the user entered their name but did not make a donation, print Donation required. Otherwise, print “Thank you name for your $donation donation!”

Hint: You will need a separate if statement to check each of three conditions

*** The name is not empty and the donation is not zero (name and donation)**
*** The name is not empty but the donation is zero**
*** The name is empty**

The paragraph in bold is a question I’ve recently encountered and I’m confused

name = input("Enter your name: ")
if name: print("Please enter your donation: ")
if not name: print(“Invalid name, kindly enter your name”)
donation = 1 > 0
** if donation < 0:**
** print(“Donation required”)**
** if 1 > 0:**
** print(" Thank you" name “for your $”**
** donation “donation”)**

This is what I put as my solution and it keeps on showing that I have a syntax error in line 5. What am I doing wrong?

“donation = 1 > 0”
What do you want this line to do? donation equals 1 is greater than 0 doesn’t really have meaning.

" if 1 > 0:" Is also problematic. One will always be greater than zero.

Hello, this is Gulshan Negi.
Well, I did a search on it, and I found some solutions to this. Well, you need to try this code, and I am sure that you will get the result you are looking for.

name = input("Enter your name: ")
if not name:
print(“Invalid name, kindly enter your name”)
else:
donation = input("Please enter your donation: ")
if not donation:
print(“Donation required”)
else:
print(“Thank you”, name, “for your $”, donation, “donation!”)

Thanks

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.