+ 1

Write a script in python

Write some lines of code so ask a number between 1 to 10 from user. If user enters the number in first attempt, print that number if it doesn't enter number in first time give him 3 chances to enter the number between 1 to 10. After 3 chances he doesn't enter the number... Exit the program.

30th Sep 2017, 6:50 AM
Neeraj Kumar
Neeraj Kumar - avatar
7 Respostas
30th Sep 2017, 6:55 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
Somewhat easy
30th Sep 2017, 6:51 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Here is my number guess. It works for numbers 1-100 and you have 10 tries. It also has a scoring. It only works in Python IDLE, because it needs input at different time so you won't be able to run it in Code Playground. https://code.sololearn.com/caXXNb7S4WQ2/?ref=app
30th Sep 2017, 7:35 AM
Tim Thuma
Tim Thuma - avatar
+ 2
I don't think that exactly such code can be run at sololearn as it takes input just once.
30th Sep 2017, 11:22 AM
Lakshay
Lakshay - avatar
+ 2
@Lakshay: code playground is not the only way to run Python script ;) It could be useful used to write/store/share Python script to be executed in other contexts (user desktop interpreter, or mobile apps as QPython for android) ^^ @Tim Thuma: do searches in code playground list, filtering only Python scripts (or not): you would find tons of guess number games ;)
30th Sep 2017, 12:00 PM
visph
visph - avatar
0
Please write the code
30th Sep 2017, 6:51 AM
Neeraj Kumar
Neeraj Kumar - avatar
0
Thanks vengat for the code... But program shouldn't terminate until user receive 3 chances to enter the number between 1 to 10
30th Sep 2017, 7:06 AM
Neeraj Kumar
Neeraj Kumar - avatar