Notifications
Clear all

Need help with Installing Python with Geany on Windows 10

21 Posts
5 Users
3 Likes
4,491 Views
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  
Posted by: @robotbuilder

Yeah a bit short on that I like things to be made easy not hard.

Same here. I just never had any problem with C++ so it never was hard for me.

I suppose if I had problems when I first started out with it I would have been somewhat discouraged as well.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  

 Here some simple python code giving examples of something that can be done with the dictionary very crude just starting out.

 

 

def main(args):
	
	print("Hello world")

	Id_dict = {
	'me' : {'me' : 'be'}
	}
	print(type(Id_dict))
	print(Id_dict)

	Query_dict = {
	'who' : {'who' : 'person'},
	'what' : {'what' : 'thing'},
	'where' : {'where' : 'location'},
	'when' : {'when' : 'time'},
	'how' : {'how' : 'explanation'},
	'why' : {'why' : 'motivation'},
	}
	print(type(Query_dict))
	
	print()
	print("print Query_dict directly")
	print()	
	print(Query_dict)



	def getList(dict): 
		return dict.keys() 

	print()
	print("get list of words - keys")
	print(getList(Query_dict))

	print()
	print("print words with for loop")

	for key in Query_dict:
		print(key)

	print()
	print("print words with enumerate ")

	for index, key in enumerate(Query_dict):
		print (index+1, key)
		

    

if __name__ == '__main__':
    import sys
    sys.exit(main(sys.argv))

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1121
 
Posted by: @robo-pi

Here some simple python code giving examples of something that can be done with the dictionary very crude just starting out.

As you passed an argument to your main function, but did nowt with it I started to doodle a bit so show what it was you had actually passed, but then I also thought it may be better to show just a bit more of the python dictionary stuff as I was a bit confused with your dictionary containing  'me' : {'me' : 'be'} as to what you where trying to achieve with this instead of just {'me':'be', 'you': 'jane:} type of dictionary etc, so I give a more typical 'starter' dictionary example based on yours in case it helps.


def main(args): # print the 'args' passed to this function print('args passed to function: ',args) print("Hello world") Id_dict = { 'me' : {'me' : 'be'} } print(type(Id_dict)) print(Id_dict) Query_dict = { 'who' : 'person', 'what' : 'thing', 'where' : 'location', 'when' : 'time', 'how' : 'explanation', 'why' : 'motivation', 'people' : ['Robo-pi', 'Byron'] } print(type(Query_dict)) print() print("print Query_dict") print(Query_dict) print("what's in key where") print("where = ", Query_dict['where']) print("Who are the people: ", Query_dict['people']) print("Who is the man, well its " , Query_dict['people'][0]) print("Whats in the key 'how'" , Query_dict.get('how', 'key not found')) print("Whats in the key 'robo'", Query_dict.get('robo', 'key not found')) print("print list of keys") print(Query_dict.keys()) print("Now I'm going to update my dictionary") Query_dict.update({'what': 'whatsUpDoc', 'when': 'All in good time', 'why': 'why not'}) print("print key-value pairs") print(Query_dict.items()) print() print("print keys with for loop") for key in Query_dict: print(key) print() print("keys and values with for loop") for key, value in Query_dict.items(): print(key,':',value) print() print("print key with enumerate ") for index, key in enumerate(Query_dict): print (index+1, key) if __name__ == '__main__': import sys sys.exit(main(sys.argv))

   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  
Posted by: @byron

I was a bit confused with your dictionary containing  'me' : {'me' : 'be'} as to what you where trying to achieve with this instead of just {'me':'be', 'you': 'jane:} type of dictionary etc, so I give a more typical 'starter' dictionary example based on yours in case it helps.

I have reasons for using compound dictionaries I will be adding even more complexity to them as they will also contain lists and various other important information, so they're going to grow in complexity they are not simple dictionaries.

 

DroneBot Workshop Robotics Engineer
James


   
byron and YurkshireLad reacted
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1121
 
Posted by: @robo-pi

I have reasons for using compound dictionaries

Ok, I just thought the code as it stood could be be misconstrued without further example of what you were going to do with your Dic of Dics.  I've used list of Dictionaries and lists in Dictionaries, but a Dictionary of Dictionaries is beyond my limited experiences, so I will be interested to see your code develop. 👍 

This post was modified 3 years ago 3 times by byron

   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
Topic starter  
Posted by: @byron

Ok, I just thought the code as it stood could be be misconstrued without further example of what you were going to do with your Dic of Dics

What I'm doing is very suited to be broken up into small dictionaries.   Each dictionary will have its own manager which will be called an agency each agency will manage a dictionary.  It's quite complex it is still in the brain-storming stage so I may change things around.   This is just the current direction that I'm headed.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
Page 2 / 2