How can i solve this problem? Help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can i solve this problem? Help

This is the problem: Write a program to ask about velocity from a user's car. In case the car surpass the 80 km/h show a message telling the user was penalize. In this case show the value of the penalize charging 5 dollars each km up to 80 km/h. I almost have it just need help in the part of the penalize how can i do the increment?

15th Aug 2018, 1:01 PM
Rody Oswaldo Mendez Villarreal
Rody Oswaldo Mendez Villarreal - avatar
5 Answers
+ 1
Could you share a link to the progress you've made so far?
15th Aug 2018, 1:21 PM
Just A Rather Ridiculously Long Username
+ 1
thanks for your help i found another solution. I wrote this if velocity > 80: penalty = ( velocity - 80) * 5 I was really frustrated about how to solve this problem. Thanks all of you for the support.
15th Aug 2018, 2:51 PM
Rody Oswaldo Mendez Villarreal
Rody Oswaldo Mendez Villarreal - avatar
0
1. inside if statement create for loop for example "for i in range(yourInt)". "yourInt" is integer which you get subtracting your velocity and speed limit. 2. inside for loop do increment yourVar += 5. 3. Then outside your loop print yourVar. I also created simple solution if you get stuck. Feel free to use it and modify. https://code.sololearn.com/cD4GqcMlkq8w/#py
15th Aug 2018, 1:46 PM
null
null - avatar
0
By the way Im in the basic concepts of Phyton I dont Know how to share with you my progress Can you tell me how to do it?
15th Aug 2018, 2:55 PM
Rody Oswaldo Mendez Villarreal
Rody Oswaldo Mendez Villarreal - avatar
0
Nice answer Rody ☺ To share your code you need: 1. Enter "code playground" 2. write your code 3. Save it 4. share it. In app just press insert button and select code that you want insert. In web enter codes URL
15th Aug 2018, 3:22 PM
null
null - avatar