Forum Archive

Beginner python practice

vincitytaymo

Well just getting into the flow of thing with Python. Reading a few books, finding it fairly easy as I already have some experience with C++/Java from school and Python is definetly my favorite thus far.

Anyway, I am getting a whole bunch of information on python, but haven't been putting it to much use. Thus, what I was wondering was if there are any sort of practice problems online that I can use? If anyone could point me in any sort of direction, I'd greatly appreciate it.

reticulated

@vincitytaymo,

Absolutely!

Pythonista:

  • Make a Text-To-Speech App (type and it says it)
  • Modify the Speech-To-Text example that is in the documentation to make a "voice note" app (speak and it just writes out the words)

General:

  • Use the requests library to show a random joke from api.chucknorris.io (uses JSON)

Notes:

Post your code here and ask folks to review it for you :)

inzel

Those are all great ideas @reticulated!

reticulated

Oh and for anyone stumbling upon this..

Anyone who knows C, please contribute using ctypes, as well those who know Objective C, some objc_util examples.

Let's try to use our individual strengths to help others!

eliskan

My favorite problem is always to design a game (though, to be fair, game design is the main reason I fell in love with programming in the first place). The app does have a nice Python game tutorial, try following that along and see if you can improve or change the game!

Another challenge: grab text from a website, parse it so you get only relevant information, and output that information in Pythonista. An easy example is take a look at a the Google "I'm feeling lucky" page and see what the result is.

And if you get that challenge down, you can take it a step further. Have the script visit a site with stocks or price ranges, and try to graph those prices in Python! This could be awesome if you're trying to built your own investment tools and want to apply your own algorithms to the graph. There's some good plot examples in the app to get you started on this.

Just some ideas! Have fun and ask yourself "what would I want my device to do, for me?" If it's not impossible then you can probably program it.

danxx26

Here is my Chuck Norris api code:

#!/usr/bin/env python
"""downloads a random Chuck Norris joke or fact using the api"""

import requests
import json
import ui
import console


def main():
    display_banner()
    print()
    console.show_activity()
    data = get_joke()
    text = parse_json(data)
    print(display_joke(text))
    # button_tapped(sender)
    console.hide_activity()


def display_banner():
    print('-' * 40)
    print('|         Chuck Norris Jokes           |')
    print('-' * 40)


def get_joke():
    response = requests.get('https://api.chucknorris.io/jokes/random')
    if response.status_code == 200:
        print(response.status_code)
        # rest = response.content
    else:
        print("error unable to connect to api\n")
        print(response.status_code)

    rest = response.content
    return rest


def parse_json(data):
    text = json.loads(data)
    text = (text['value'])
    # print(text)
    return text


def display_joke(text):
    formatted = str(text).strip()
    # print(type(formatted))
    return formatted


# def button_tapped(sender):
# chuck = button_tapped(sender)
#    sender.title = chuck
#    view = ui.load_view('chuck')
#    view.present('full_screen')
#    return # #view.present('full_screen')

if __name__ == '__main__':
    main()
Bargavi

Thanks for info on Beginner python practice jira

LennonJohn

Students Assignment help by experienced professional programmers of USA,UK & AUS. We offer Java, PHP, C,Python , C++ programming language.FOR MORE : C++ Assignment help online

vijaydeveloper

Hi,
For learning paths just follow the link.

jswami123

Thanks for this great idea.

shivkumar

You can go for Online training or classroom training which is very easy to learn the concept. Python language is easy to learn as compared to Java, C#, C++, PHP, javascript and many more.

Katerina

You can also check out coding challenges on CheckIO. It's a great platform for python practice, where you can have fun while learning something new, solving interesting tasks and analizing the unique solutions of other users. It's free, friendly and has a lot of tools you can use)