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
  needing some help to write some code for a game calculator rymdaksel 1 356 Jan-02-2024, 09:56 AM
Last Post: deanhystad
  Better way to write this function SephMon 1 789 Feb-08-2023, 10:05 PM
Last Post: Gribouillis
  write new function or change the old one to work "smartter? korenron 3 1,925 Aug-09-2021, 10:36 AM
Last Post: jamesaarr
  Putting code into a function breaks its functionality, though the code is identical! PCesarano 1 1,949 Apr-05-2021, 05:40 PM
Last Post: deanhystad
  How can I write a function with three parameters? MehmetAliKarabulut 1 2,375 Mar-04-2021, 10:47 PM
Last Post: Larz60+
  Hi Guys, please help me to write SAS macro parameter equivalent code in Python Manohar9589 2 2,538 Jun-14-2020, 05:07 PM
Last Post: Larz60+
  Print/write to file function tpolim008 4 2,705 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 3,062 Feb-24-2020, 12:06 PM
Last Post: Larz60+
  write an integer to file using a function xvkxvo 4 3,100 Dec-10-2019, 11:27 PM
Last Post: xvkxvo
  how can I write my function output on CSV file go127a 13 5,413 May-05-2019, 01:55 PM
Last Post: go127a

Forum Jump:

User Panel Messages

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