Hi people how can I program the following on python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Hi people how can I program the following on python

Write a program that asks the user to enter an angle between -180 and 180°.using an expression with the modulo operator,convert the angle to its equivalent between 0° and 360° I tried angl=float(input("please enter the angle you want")) from random import randint X=randint(0,360) angl=x a=360+angle print(a) But I don't really understand the question too so of you can make it with detail and beginner friendly

30th May 2020, 5:43 PM
Elliot
2 Answers
+ 3
For a more general answer; "%" is the modulo operator. Simply do: angl = float(input()) print(angl % 360)
30th May 2020, 5:55 PM
Russ
Russ - avatar
+ 2
Do you only need to convert angle between -180 and 180 to its equivalent between 0° and 360°? if that's so just add 180 to the input
30th May 2020, 5:48 PM
Hacker Badshah
Hacker Badshah - avatar