Can someone help me translating this python code into C? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can someone help me translating this python code into C?

I'´d like to make this code like an app for a friend's smartwatch and I'm still learning Python and I can't get into C. The purpose is to give a prediction everytime you click your smartwatch's button so if someone can develope it for what I want that would be nice. If someone could it would be pretty nice. I'm spanish so variable are written in Spanish sorry :). This is just the title of the app # La bola de la suerte de los examenes q = "Atento a las unidades." w = "Deberías haber estudiado más." e = "Mereces suspender." r = "Me da a mí que no has estudiado suficiente." t = "Eres un/a inútil." y = "Por supuesto." u = "Claro que sí campeón." i = "Por supuesto" o = "Sisisisi, sin duda" p = "Bueno, no mucho" a = "No cabe duda que sí" import random r_number= random.randint(0,11) list= [q, w, e, r, t, y, u, i, o, p, a] print (str(list[r_number]))

15th Jan 2018, 10:36 PM
Pedro Parrilla
Pedro Parrilla - avatar
9 Answers
+ 4
Note your non-ascii characters don't display right. https://code.sololearn.com/cMd78S3YGPy5/?ref=app
15th Jan 2018, 11:35 PM
John Wells
John Wells - avatar
+ 2
I can convert to C. But, know nothing about smartwatches.
15th Jan 2018, 11:09 PM
John Wells
John Wells - avatar
+ 2
What watch?
16th Jan 2018, 12:27 AM
John Wells
John Wells - avatar
+ 1
Thank you! Don't worry about the buttons function i'll try to find a solution. The main difficulty was to write the code on C. Thank you for the help!!:)
15th Jan 2018, 11:25 PM
Pedro Parrilla
Pedro Parrilla - avatar
+ 1
Thank you really much, if I want to add more variables i only hace to write them between double quotes and then separate them by commas isn't it?
15th Jan 2018, 11:54 PM
Pedro Parrilla
Pedro Parrilla - avatar
+ 1
There should be a way to get them printed correctly and I'm still trying. If you L"message" each string and add "%ls", to printf it displays better but wrong. printf("%ls", list[ran]);
16th Jan 2018, 12:11 AM
John Wells
John Wells - avatar
+ 1
Well it sounds like chinese to me jajaja but don't really worry for that it is just for my friend and me so i'll delete the accents. Ty another time :)
16th Jan 2018, 12:24 AM
Pedro Parrilla
Pedro Parrilla - avatar
+ 1
I'm going to play because it has to be doable and eventually someone will ask. Make no promises, but will post once found.
16th Jan 2018, 12:26 AM
John Wells
John Wells - avatar
0
it was the pebble's first smartwatch (Pebble Classic) to release the app i have to upload it to Pebble's website and then i have to set up the buttons' function
16th Jan 2018, 8:25 AM
Pedro Parrilla
Pedro Parrilla - avatar