Python Forum
How to write a code with İF function?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to write a code with İF function?
#1
How to create a program that changes the digits of a number that that we enter, so
that the highest digit value becomes the first digit by using if structure. For example, in the four digit number
(abcd) if © is the highest valued digit, then the number will be changed to (cabd).
Reply
#2
Do you have to use "if"?

For your example, do you mean that 1234 would become 4123 or 4321?

What is your idea for getting hold of the digits in your four digit number? I would start with that part. If you can get the digits the rest is pretty easy.

You should post this under the Homework section.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Hi Guys, please help me to write SAS macro parameter equivalent code in Python Manohar9589 2 537 Jun-14-2020, 05:07 PM
Last Post: Larz60+
  Print/write to file function tpolim008 4 631 Apr-01-2020, 07:59 PM
Last Post: tpolim008
  How to write test cases for a init function by Unit test in python? binhduonggttn 2 933 Feb-24-2020, 12:06 PM
Last Post: Larz60+
  write an integer to file using a function xvkxvo 4 746 Dec-10-2019, 11:27 PM
Last Post: xvkxvo
  how can I write my function output on CSV file go127a 13 1,550 May-05-2019, 01:55 PM
Last Post: go127a
  How do i write tests for this code? hshivaraj 0 714 Apr-27-2019, 05:28 PM
Last Post: hshivaraj
  Use the write function manonB 2 751 Apr-17-2019, 05:55 AM
Last Post: manonB
  Help trying to write a function Rochense 3 1,026 Apr-12-2019, 02:34 PM
Last Post: Gribouillis
  'function' object has no attribute 'write' paramiko lateublegende 1 2,257 Feb-12-2019, 09:03 PM
Last Post: nilamo
  How to write a code to get this kind of output in IDLE kavindu 5 1,302 Oct-28-2018, 07:46 PM
Last Post: wavic

Forum Jump:

User Panel Messages

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