|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "code", |
| 5 | + "execution_count": 7, |
| 6 | + "id": "6aef2608", |
| 7 | + "metadata": {}, |
| 8 | + "outputs": [ |
| 9 | + { |
| 10 | + "ename": "TypeError", |
| 11 | + "evalue": "'type' object is not iterable", |
| 12 | + "output_type": "error", |
| 13 | + "traceback": [ |
| 14 | + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", |
| 15 | + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", |
| 16 | + "Input \u001b[1;32mIn [7]\u001b[0m, in \u001b[0;36m<cell line: 2>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m sets\u001b[38;5;241m=\u001b[39m{\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mquestion\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124moption\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcurrect_ans\u001b[39m\u001b[38;5;124m'\u001b[39m,\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpoint\u001b[39m\u001b[38;5;124m'\u001b[39m}\n\u001b[1;32m----> 2\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mset\u001b[39m:\n\u001b[0;32m 3\u001b[0m sets\u001b[38;5;241m.\u001b[39msetdefault(\u001b[38;5;28minput\u001b[39m())\n\u001b[0;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(sets)\n", |
| 17 | + "\u001b[1;31mTypeError\u001b[0m: 'type' object is not iterable" |
| 18 | + ] |
| 19 | + } |
| 20 | + ], |
| 21 | + "source": [ |
| 22 | + "sets={'question','option','currect_ans','point'}\n", |
| 23 | + "for i in set:\n", |
| 24 | + " sets.setdefault(input())\n", |
| 25 | + " print(sets)\n", |
| 26 | + " " |
| 27 | + ] |
| 28 | + }, |
| 29 | + { |
| 30 | + "cell_type": "code", |
| 31 | + "execution_count": 8, |
| 32 | + "id": "100de798", |
| 33 | + "metadata": {}, |
| 34 | + "outputs": [ |
| 35 | + { |
| 36 | + "name": "stdout", |
| 37 | + "output_type": "stream", |
| 38 | + "text": [ |
| 39 | + "Enter Your Question: what is python\n", |
| 40 | + "Enter Your Option: programming language, software, hardware, none\n", |
| 41 | + "programming language\n", |
| 42 | + "right answer \n" |
| 43 | + ] |
| 44 | + } |
| 45 | + ], |
| 46 | + "source": [ |
| 47 | + "question=input('Enter Your Question: ')\n", |
| 48 | + "option=input('Enter Your Option: ')\n", |
| 49 | + "currect_ans=input()\n", |
| 50 | + "point=0\n", |
| 51 | + "if currect_ans in option:\n", |
| 52 | + " print('right answer ')\n", |
| 53 | + " point+=1\n", |
| 54 | + "else:\n", |
| 55 | + " print('wrong answer')" |
| 56 | + ] |
| 57 | + }, |
| 58 | + { |
| 59 | + "cell_type": "code", |
| 60 | + "execution_count": 9, |
| 61 | + "id": "7349bbf6", |
| 62 | + "metadata": {}, |
| 63 | + "outputs": [], |
| 64 | + "source": [ |
| 65 | + "question_bank={question,option,currect_ans,point}\n", |
| 66 | + "for i in question_bank:\n", |
| 67 | + " input()" |
| 68 | + ] |
| 69 | + }, |
| 70 | + { |
| 71 | + "cell_type": "code", |
| 72 | + "execution_count": null, |
| 73 | + "id": "c59e2405", |
| 74 | + "metadata": {}, |
| 75 | + "outputs": [], |
| 76 | + "source": [] |
| 77 | + } |
| 78 | + ], |
| 79 | + "metadata": { |
| 80 | + "kernelspec": { |
| 81 | + "display_name": "Python 3 (ipykernel)", |
| 82 | + "language": "python", |
| 83 | + "name": "python3" |
| 84 | + }, |
| 85 | + "language_info": { |
| 86 | + "codemirror_mode": { |
| 87 | + "name": "ipython", |
| 88 | + "version": 3 |
| 89 | + }, |
| 90 | + "file_extension": ".py", |
| 91 | + "mimetype": "text/x-python", |
| 92 | + "name": "python", |
| 93 | + "nbconvert_exporter": "python", |
| 94 | + "pygments_lexer": "ipython3", |
| 95 | + "version": "3.9.12" |
| 96 | + } |
| 97 | + }, |
| 98 | + "nbformat": 4, |
| 99 | + "nbformat_minor": 5 |
| 100 | +} |
0 commit comments