Python Forum
Branching and Conditionals/If statements
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Branching and Conditionals/If statements
#1
I am currently doing a group of python assignments and I need help with completing them.

I am currently stuck on both of the problems listed below.If someone could quickly help me do them that would be greatly appreciated!

Ask the user to input a number. If the number is divisible by 2 print “even”. If it is divisible by 3 print “divisible by 3”. If it is divisible by 5, print “divisible by 5”. If it’s divisible by 10, print “divisible by 10”. If the number is divisible by more than one of these numbers, print only the highest number it is divisible by (ie. For number = 150, the program should print “divisible by 10”). If the number is not divisible by any number, print "not divisible by 2, 3,
5 or 10.


2.Allow the user to input two integers, a and b. Use branching to print True if either of the two numbers is equal to 5, or if the sum or difference of the numbers equals 5. Otherwise, print False.
Reply
#2
we are glad to help with code that you have written.
We do not write code for you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Doubt about conditionals in Python. Carmazum 6 1,536 Apr-01-2023, 12:01 AM
Last Post: Carmazum
  conditionals based on data frame mbrown009 1 873 Aug-12-2022, 08:18 AM
Last Post: Larz60+
  Efficiency with regard to nested conditionals or and statements Mark17 13 3,080 May-06-2022, 05:16 PM
Last Post: Mark17
  Nested conditionals vs conditionals connected by operators dboxall123 8 2,983 Feb-18-2022, 09:34 PM
Last Post: dboxall123
Big Grin Newbie to Python - input and branching issue Sherine 3 2,187 Jul-31-2021, 01:09 AM
Last Post: Pedroski55
  Nested Conditionals shen123 3 2,584 Jul-28-2021, 08:24 AM
Last Post: Yoriz
  Invalid syntax using conditionals if - else jperezqu 1 2,295 Jan-13-2021, 07:32 PM
Last Post: bowlofred
  conditionals with boolean logic?? ridgerunnersjw 3 1,958 Sep-26-2020, 02:13 PM
Last Post: deanhystad
  two conditionals with intermediate code Skaperen 5 2,713 Jul-12-2020, 07:18 PM
Last Post: Skaperen
  Conditionals, while loops, continue, break (PyBite 102) Drone4four 2 2,923 Jun-04-2020, 12:08 PM
Last Post: Drone4four

Forum Jump:

User Panel Messages

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