0
Need help in my code
Hello! I'm studying mechanical engineering. I have project on spycam on raspberry pi so i make a code for spycam but it's too lengthy cause I'm just beginner. I don't know everything about coding. I just need help to make it shorter. Further detail I will give you. Code is given in link below. https://drive.google.com/folderview?id=15ugXZANDoNLcwpA2QyIbcRSDjuC3Web_ Regards, Zaryaab Rizwan https://code.sololearn.com/cowK1V4yutqK/?ref=app https://code.sololearn.com/cowK1V4yutqK/?ref=app https://code.sololearn.com/cowK1V4yutqK/?ref=app
2 odpowiedzi
+ 2
Can you share your code in the code playground by copying the code?
+ 2
You can change your whole load of if statements into:
Display.Show1(3, c%10)
Display.Show1(2, c//10)
c%10 returns the remainder when c is divided by 10 (which will be the units number) and c//10 is the number of times c can be wholly divided by 10.